home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / srgpsph3 / lib / sphigs.lib next >
Encoding:
Text File  |  1994-02-17  |  286.5 KB  |  9,478 lines

  1. eat
  2.     Color := RandColor;
  3.     SetColor(Color);
  4.     SetFillStyle(Random(CloseDotFill)+1, Color);
  5.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  6.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  7.   until KeyPressed;
  8.   WaitToGo;
  9. end; { RandBarPlay }
  10.  
  11. procedure ArcPlay;
  12. { Draw random arcs on the screen }
  13. var
  14.   MaxRadius : word;
  15.   EndAngle : word;
  16.   ArcInfo : ArcCoordsType;
  17. begin
  18.   MainWindow('Arc / GetArcCoords demonstration');
  19.   StatusLine('Esc aborts or press a key');
  20.   MaxRadius := MaxY div 10;
  21.   repeat
  22.     SetColor(RandColor);
  23.     EndAngle := Random(360);
  24.     SetLineStyle(SolidLn, 0, NormWidth);
  25.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  26.     GetArcCoords(ArcInfo);
  27.     with ArcInfo do
  28.     begin
  29.       Line(X, Y, XStart, YStart);
  30.       Line(X, Y, Xend, Yend);
  31.     end;
  32.   until KeyPressed;
  33.   WaitToGo;
  34. end; { ArcPlay }
  35.  
  36. procedure PutPixelPlay;
  37. { Demonstrate the PutPixel and GetPixel commands }
  38. const
  39.   Seed   = 1962; { A seed for the random number generator }
  40.   NumPts = 2000; { The number of pixels plotted }
  41.   Esc    = #27;
  42. var
  43.   I : word;
  44.   X, Y, Color : word;
  45.   XMax, YMax  : integer;
  46.   ViewInfo    : ViewPortType;
  47. begin
  48.   MainWindow('PutPixel / GetPixel demonstration');
  49.   StatusLine('Esc aborts or press a key...');
  50.  
  51.   GetViewSettings(ViewInfo);
  52.   with ViewInfo do
  53.   begin
  54.     XMax := (x2-x1-1);
  55.     YMax := (y2-y1-1);
  56.   end;
  57.  
  58.   while not KeyPressed do
  59.   begin
  60.     { Plot random pixels }
  61.     RandSeed := Seed;
  62.     I := 0;
  63.     while (not KeyPressed) and (I < NumPts) do
  64.     begin
  65.       Inc(I);
  66.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  67.     end;
  68.  
  69.     { Erase pixels }
  70.     RandSeed := Seed;
  71.     I := 0;
  72.     while (not KeyPressed) and (I < NumPts) do
  73.     begin
  74.       Inc(I);
  75.       X := Random(XMax)+1;
  76.       Y := Random(YMax)+1;
  77.       Color := GetPixel(X, Y);
  78.         if Color = RandColor then
  79.           PutPixel(X, Y, 0);
  80.      end;
  81.   end;
  82.   WaitToGo;
  83. end; { PutPixelPlay }
  84.  
  85. procedure PutImagePlay;
  86. { Demonstrate the GetImage and PutImage commands }
  87.  
  88. const
  89.   r  = 20;
  90.   StartX = 100;
  91.   StartY = 50;
  92.  
  93. var
  94.   CurPort : ViewPortType;
  95.  
  96. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  97. var
  98.   Step : integer;
  99. begin
  100.   Step := Random(2*r);
  101.   if Odd(Step) then
  102.     Step := -Step;
  103.   X := X + Step;
  104.   Step := Random(r);
  105.   if Odd(Step) then
  106.     Step := -Step;
  107.   Y := Y + Step;
  108.  
  109.   { Make saucer bounce off viewport walls }
  110.   with CurPort do
  111.   begin
  112.     if (x1 + X + Width - 1 > x2) then
  113.       X := x2-x1 - Width + 1
  114.     else
  115.       if (X < 0) then
  116.         X := 0;
  117.     if (y1 + Y + Height - 1 > y2) then
  118.       Y := y2-y1 - Height + 1
  119.     else
  120.       if (Y < 0) then
  121.         Y := 0;
  122.   end;
  123. end; { MoveSaucer }
  124.  
  125. var
  126.   Pausetime : word;
  127.   Saucer    : pointer;
  128.   X, Y      : integer;
  129.   ulx, uly  : word;
  130.   lrx, lry  : word;
  131.   Size      : word;
  132.   I         : word;
  133. begin
  134.   ClearDevice;
  135.   FullPort;
  136.  
  137.   { PaintScreen }
  138.   ClearDevice;
  139.   MainWindow('GetImage / PutImage Demonstration');
  140.   StatusLine('Esc aborts or press a key...');
  141.   GetViewSettings(CurPort);
  142.  
  143.   { DrawSaucer }
  144.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  145.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  146.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  147.   Circle(StartX+10, StartY-12, 2);
  148.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  149.   Circle(StartX-10, StartY-12, 2);
  150.   SetFillStyle(SolidFill, MaxColor);
  151.   FloodFill(StartX+1, StartY+4, GetColor);
  152.  
  153.   { ReadSaucerImage }
  154.   ulx := StartX-(r+1);
  155.   uly := StartY-14;
  156.   lrx := StartX+(r+1);
  157.   lry := StartY+(r div 3)+3;
  158.  
  159.   Size := ImageSize(ulx, uly, lrx, lry);
  160.   GetMem(Saucer, Size);
  161.   GetImage(ulx, uly, lrx, lry, Saucer^);
  162. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  163.  
  164.   { Plot some "stars" }
  165.   for I := 1 to 1000 do
  166.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  167.   X := MaxX div 2;
  168.   Y := MaxY div 2;
  169.   PauseTime := 70;
  170.  
  171.   { Move the saucer around }
  172.   repeat
  173. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  174.      Delay(PauseTime);
  175. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  176.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  177.   until KeyPressed;
  178.   FreeMem(Saucer, size);
  179.   WaitToGo;
  180. end; { PutImagePlay }
  181.  
  182. procedure PolyPlay;
  183. { Draw random polygons with random fill styles on the screen }
  184. const
  185.   MaxPts = 5;
  186. type
  187.   PolygonType = array[1..MaxPts] of PointType;
  188. var
  189.   Poly : PolygonType;
  190.   I, Color : word;
  191. begin
  192.   MainWindow('FillPoly demonstration');
  193.   StatusLine('Esc aborts or press a key...');
  194.   repeat
  195.     Color := RandColor;
  196.     SetFillStyle(Random(11)+1, Color);
  197.     SetColor(Color);
  198.     for I := 1 to MaxPts do
  199.       with Poly[I] do
  200.       begin
  201.         X := Random(MaxX);
  202.         Y := Random(MaxY);
  203.       end;
  204.     FillPoly(MaxPts, Poly);
  205.   until KeyPressed;
  206.   WaitToGo;
  207. end; { PolyPlay }
  208.  
  209. procedure FillStylePlay;
  210. { Display all of the predefined fill styles available }
  211. var
  212.   Style    : word;
  213.   Width    : word;
  214.   Height   : word;
  215.   X, Y     : word;
  216.   I, J     : word;
  217.   ViewInfo : ViewPortType;
  218.  
  219. procedure DrawBox(X, Y : word);
  220. begin
  221.   SetFillStyle(Style, MaxColor);
  222.   with ViewInfo do
  223.     Bar(X, Y, X+Width, Y+Height);
  224.   Rectangle(X, Y, X+Width, Y+Height);
  225.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  226.   Inc(Style);
  227. end; { DrawBox }
  228.  
  229. begin
  230.   MainWindow('Pre-defined fill styles');
  231.   GetViewSettings(ViewInfo);
  232.   with ViewInfo do
  233.   begin
  234.     Width := 2 * ((x2+1) div 13);
  235.     Height := 2 * ((y2-10) div 10);
  236.   end;
  237.   X := Width div 2;
  238.   Y := Height div 2;
  239.   Style := 0;
  240.   for J := 1 to 3 do
  241.   begin
  242.     for I := 1 to 4 do
  243.     begin
  244.       DrawBox(X, Y);
  245.       Inc(X, (Width div 2) * 3);
  246.     end;
  247.     X := Width div 2;
  248.     Inc(Y, (Height div 2) * 3);
  249.   end;
  250.   SetTextJustify(LeftText, TopText);
  251.   WaitToGo;
  252. end; { FillStylePlay }
  253.  
  254. procedure FillPatternPlay;
  255. { Display some user defined fill patterns }
  256. const
  257.   Patterns : array[0..11] of FillPatternType = (
  258.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  259.             OldColor which has a path of pixels of OldColor or NewColor
  260.             with sides touching back to the seed point, (XSeed, YSeed).
  261.             Therefore, only pixels of OldColor are modified and no other
  262.             information is changed.
  263.  
  264.             SEE ALSO
  265.  
  266.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  267.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  268.             SETVIEW
  269.  
  270.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  271.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  272.             IF WHICHVGA = 0 THEN STOP
  273.             DUMMY=RES640
  274.             SETVIEW 100, 100, 539, 379
  275.             FILLVIEW 10
  276.             WHILE INKEY$ = ""
  277.             WEND
  278.             VIDEOMODESET VMODE
  279.             END
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.                                                                          63
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.           FONTGETINFO
  304.  
  305.             PROTOTYPE
  306.  
  307.             SUB FONTGETINFO (Width%, Height%)
  308.  
  309.             INPUT
  310.  
  311.             no input parameters
  312.     WEND
  313.             MOUSEEXIT
  314.             VIDEOMODESET VMODE
  315.             END
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.                                                                          86
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.           MOUSECURSORDEFAULT
  364.  
  365.             PROTOTYPE
  366.  
  367.             SUB MOUSECURSORDEFAULT ()
  368.  
  369.             INPUT
  370.  
  371.             no input parameters
  372.  
  373.             OUTPUT
  374.  
  375.             no value returned
  376.  
  377.             USAGE
  378.  
  379.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  380.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  381. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  382. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  383. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  384. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  385. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  386. $╤
  387. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  388. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  389. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  390. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  391. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  392. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  393. ░£▒
  394. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  395. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  396.       end;
  397.     end;
  398.   end;
  399.   WaitToGo;
  400. end; { UserLineStylePlay }
  401.  
  402.  
  403. procedure SayGoodbye;
  404. { Say goodbye and then exit the program }
  405. var
  406.   ViewInfo : ViewPortType;
  407. begin
  408.   MainWindow('');
  409.   GetViewSettings(ViewInfo);
  410.   SetTextStyle(TriplexFont, HorizDir, 4);
  411.   SetTextJustify(CenterText, CenterText);
  412.   with ViewInfo do
  413.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  414.   StatusLine('Press any key to quit...');
  415.   repeat until KeyPressed;
  416. end; { SayGoodbye }
  417.  
  418.  
  419. PROCEDURE SelectMode;
  420. VAR
  421.     choice1,choice2     : CHAR;
  422.    xsize,ysize            : WORD;
  423. BEGIN
  424.     (* Let's select a mode *)
  425.     ClrScr;
  426.     WriteLn('VESADEMO:');
  427.     WriteLn('1. 256 colors');
  428.     WriteLn('2. 32768 colors');
  429.     WriteLn('3. 65536 colors');
  430.     WriteLn('4. 16777216 colors');
  431.     WriteLn('Q uit');
  432.     WriteLn;
  433.     Write('Your choice: ');
  434.     REPEAT
  435.         ReadLn(choice1);
  436.       IF choice1 <> '1' THEN BEGIN
  437.           WriteLn('Sorry !');
  438.          WriteLn('This demo wasn''t written for more as 256 colors !');
  439.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  440.          WriteLn('Switching to 256 colors.');
  441.          choice1 := '1';
  442.       END;
  443.     UNTIL choice1 IN ['1'..'4','q'];
  444.     IF choice1 = 'q' THEN Halt;
  445.  
  446.     WriteLn;
  447.     WriteLn;
  448.     WriteLn('a. 320x200');
  449.     WriteLn('b. 640x480');
  450.     WriteLn('c. 800x600');
  451.     WriteLn('d. 1024x768');
  452.     WriteLn('e. 1280x1024');
  453.     WriteLn('Q uit');
  454.     WriteLn;
  455.     Write('Your choice: ');
  456.     REPEAT
  457.         ReadLn(choice2);
  458.     UNTIL choice2 IN ['a'..'e','q'];
  459.     IF choice2 = 'q' THEN Halt;
  460.  
  461.     CASE choice2 OF
  462.         'a' : BEGIN
  463.             xsize := 320;
  464.             ysize := 200;
  465.         END;
  466.         'b' : BEGIN
  467.             xsize := 640;
  468.             ysize := 480;
  469.         END;
  470.         'c' : BEGIN
  471.             xsize := 800;
  472.             ysize := 600;
  473.         END;
  474.         'd' : BEGIN
  475.             xsize := 1024;
  476.             ysize := 768;
  477.         END;
  478.         'e' : BEGIN
  479.             xsize := 1280;
  480.             ysize := 1024;
  481.         END;
  482.     END;
  483.     CASE choice1 OF
  484.         '1' : mode := FindVesaMode(xsize,ysize,8);
  485.         '2' : mode := FindVesaMode(xsize,ysize,15);
  486.         '3' : mode := FindVesaMode(xsize,ysize,16);
  487.         '4' : mode := FindVesaMode(xsize,ysize,24);
  488.     END;
  489.     IF mode = 0 THEN BEGIN
  490.         WriteLn('No such mode could be found !');
  491.         WriteLn('Switching to to 320x200.');
  492.         ReadKey;
  493.         mode := V320x200x256;
  494.     END;
  495. END;
  496.  
  497. begin { program body }
  498.   SelectMode;
  499.   Initialize;
  500.   ReportStatus;
  501.  
  502. {  AspectRatioPlay; }
  503.   FillEllipsePlay;
  504.   SectorPlay;
  505.   WriteModePlay;
  506.  
  507.   ColorPlay;
  508.   { PalettePlay only intended to work on these drivers: }
  509.   if (GraphDriver = EGA) or
  510.       (GraphDriver = EGA64) or
  511.       (GraphDriver = VGA) then
  512.      PalettePlay;
  513.   PutPixelPlay;
  514. {  PutImagePlay; }
  515.   RandBarPlay;
  516.   BarPlay;
  517.   Bar3DPlay;
  518.   ArcPlay;
  519.   CirclePlay;
  520.   PiePlay;
  521.   LineToPlay;
  522.   LineRelPlay;
  523. {  LineStylePlay; }
  524. {  UserLineStylePlay; }
  525.   TextDump;
  526.   TextPlay;
  527.   CrtModePlay;
  528.   FillStylePlay;
  529.   FillPatternPlay;
  530.   PolyPlay;
  531.   SayGoodbye;
  532. {  CloseGraph; }
  533.   CloseVesa;
  534. end.
  535. ***************************************************
  536.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  537.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  538. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  539. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  540. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  541. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  542.     Color := RandColor;
  543.     SetColor(Color);
  544.     SetFillStyle(Random(CloseDotFill)+1, Color);
  545.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  546.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  547.   until KeyPressed;
  548.   WaitToGo;
  549. end; { RandBarPlay }
  550.  
  551. procedure ArcPlay;
  552. { Draw random arcs on the screen }
  553. var
  554.   MaxRadius : word;
  555.   EndAngle : word;
  556.   ArcInfo : ArcCoordsType;
  557. begin
  558.   MainWindow('Arc / GetArcCoords demonstration');
  559.   StatusLine('Esc aborts or press a key');
  560.   MaxRadius := MaxY div 10;
  561.   repeat
  562.     SetColor(RandColor);
  563.     EndAngle := Random(360);
  564.     SetLineStyle(SolidLn, 0, NormWidth);
  565.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  566.     GetArcCoords(ArcInfo);
  567.     with ArcInfo do
  568.     begin
  569.       Line(X, Y, XStart, YStart);
  570.       Line(X, Y, Xend, Yend);
  571.     end;
  572.   until KeyPressed;
  573.   WaitToGo;
  574. end; { ArcPlay }
  575.  
  576. procedure PutPixelPlay;
  577. { Demonstrate the PutPixel and GetPixel commands }
  578. const
  579.   Seed   = 1962; { A seed for the random number generator }
  580.   NumPts = 2000; { The number of pixels plotted }
  581.   Esc    = #27;
  582. var
  583.   I : word;
  584.   X, Y, Color : word;
  585.   XMax, YMax  : integer;
  586.   ViewInfo    : ViewPortType;
  587. begin
  588.   MainWindow('PutPixel / GetPixel demonstration');
  589.   StatusLine('Esc aborts or press a key...');
  590.  
  591.   GetViewSettings(ViewInfo);
  592.   with ViewInfo do
  593.   begin
  594.     XMax := (x2-x1-1);
  595.     YMax := (y2-y1-1);
  596.   end;
  597.  
  598.   while not KeyPressed do
  599.   begin
  600.     { Plot random pixels }
  601.     RandSeed := Seed;
  602.     I := 0;
  603.     while (not KeyPressed) and (I < NumPts) do
  604.     begin
  605.       Inc(I);
  606.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  607.     end;
  608.  
  609.     { Erase pixels }
  610.     RandSeed := Seed;
  611.     I := 0;
  612.     while (not KeyPressed) and (I < NumPts) do
  613.     begin
  614.       Inc(I);
  615.       X := Random(XMax)+1;
  616.       Y := Random(YMax)+1;
  617.       Color := GetPixel(X, Y);
  618.         if Color = RandColor then
  619.           PutPixel(X, Y, 0);
  620.      end;
  621.   end;
  622.   WaitToGo;
  623. end; { PutPixelPlay }
  624.  
  625. procedure PutImagePlay;
  626. { Demonstrate the GetImage and PutImage commands }
  627.  
  628. const
  629.   r  = 20;
  630.   StartX = 100;
  631.   StartY = 50;
  632.  
  633. var
  634.   CurPort : ViewPortType;
  635.  
  636. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  637. var
  638.   Step : integer;
  639. begin
  640.   Step := Random(2*r);
  641.   if Odd(Step) then
  642.     Step := -Step;
  643.   X := X + Step;
  644.   Step := Random(r);
  645.   if Odd(Step) then
  646.     Step := -Step;
  647.   Y := Y + Step;
  648.  
  649.   { Make saucer bounce off viewport walls }
  650.   with CurPort do
  651.   begin
  652.     if (x1 + X + Width - 1 > x2) then
  653.       X := x2-x1 - Width + 1
  654.     else
  655.       if (X < 0) then
  656.         X := 0;
  657.     if (y1 + Y + Height - 1 > y2) then
  658.       Y := y2-y1 - Height + 1
  659.     else
  660.       if (Y < 0) then
  661.         Y := 0;
  662.   end;
  663. end; { MoveSaucer }
  664.  
  665. var
  666.   Pausetime : word;
  667.   Saucer    : pointer;
  668.   X, Y      : integer;
  669.   ulx, uly  : word;
  670.   lrx, lry  : word;
  671.   Size      : word;
  672.   I         : word;
  673. begin
  674.   ClearDevice;
  675.   FullPort;
  676.  
  677.   { PaintScreen }
  678.   ClearDevice;
  679.   MainWindow('GetImage / PutImage Demonstration');
  680.   StatusLine('Esc aborts or press a key...');
  681.   GetViewSettings(CurPort);
  682.  
  683.   { DrawSaucer }
  684.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  685.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  686.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  687.   Circle(StartX+10, StartY-12, 2);
  688.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  689.   Circle(StartX-10, StartY-12, 2);
  690.   SetFillStyle(SolidFill, MaxColor);
  691.   FloodFill(StartX+1, StartY+4, GetColor);
  692.  
  693.   { ReadSaucerImage }
  694.   ulx := StartX-(r+1);
  695.   uly := StartY-14;
  696.   lrx := StartX+(r+1);
  697.   lry := StartY+(r div 3)+3;
  698.  
  699.   Size := ImageSize(ulx, uly, lrx, lry);
  700.   GetMem(Saucer, Size);
  701.   GetImage(ulx, uly, lrx, lry, Saucer^);
  702. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  703.  
  704.   { Plot some "stars" }
  705.   for I := 1 to 1000 do
  706.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  707.   X := MaxX div 2;
  708.   Y := MaxY div 2;
  709.   PauseTime := 70;
  710.  
  711.   { Move the saucer around }
  712.   repeat
  713. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  714.      Delay(PauseTime);
  715. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  716.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  717.   until KeyPressed;
  718.   FreeMem(Saucer, size);
  719.   WaitToGo;
  720. end; { PutImagePlay }
  721.  
  722. procedure PolyPlay;
  723. { Draw random polygons with random fill styles on the screen }
  724. const
  725.   MaxPts = 5;
  726. type
  727.   PolygonType = array[1..MaxPts] of PointType;
  728. var
  729.   Poly : PolygonType;
  730.   I, Color : word;
  731. begin
  732.   MainWindow('FillPoly demonstration');
  733.   StatusLine('Esc aborts or press a key...');
  734.   repeat
  735.     Color := RandColor;
  736.     SetFillStyle(Random(11)+1, Color);
  737.     SetColor(Color);
  738.     for I := 1 to MaxPts do
  739.       with Poly[I] do
  740.       begin
  741.         X := Random(MaxX);
  742.         Y := Random(MaxY);
  743.       end;
  744.     FillPoly(MaxPts, Poly);
  745.   until KeyPressed;
  746.   WaitToGo;
  747. end; { PolyPlay }
  748.  
  749. procedure FillStylePlay;
  750. { Display all of the predefined fill styles available }
  751. var
  752.   Style    : word;
  753.   Width    : word;
  754.   Height   : word;
  755.   X, Y     : word;
  756.   I, J     : word;
  757.   ViewInfo : ViewPortType;
  758.  
  759. procedure DrawBox(X, Y : word);
  760. begin
  761.   SetFillStyle(Style, MaxColor);
  762.   with ViewInfo do
  763.     Bar(X, Y, X+Width, Y+Height);
  764.   Rectangle(X, Y, X+Width, Y+Height);
  765.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  766.   Inc(Style);
  767. end; { DrawBox }
  768.  
  769. begin
  770.   MainWindow('Pre-defined fill styles');
  771.   GetViewSettings(ViewInfo);
  772.   with ViewInfo do
  773.   begin
  774.     Width := 2 * ((x2+1) div 13);
  775.     Height := 2 * ((y2-10) div 10);
  776.   end;
  777.   X := Width div 2;
  778.   Y := Height div 2;
  779.   Style := 0;
  780.   for J := 1 to 3 do
  781.   begin
  782.     for I := 1 to 4 do
  783.     begin
  784.       DrawBox(X, Y);
  785.       Inc(X, (Width div 2) * 3);
  786.     end;
  787.     X := Width div 2;
  788.     Inc(Y, (Height div 2) * 3);
  789.   end;
  790.   SetTextJustify(LeftText, TopText);
  791.   WaitToGo;
  792. end; { FillStylePlay }
  793.  
  794. procedure FillPatternPlay;
  795. { Display some user defined fill patterns }
  796. const
  797.   Patterns : array[0..11] of FillPatternType = (
  798.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  799.             OldColor which has a path of pixels of OldColor or NewColor
  800.             with sides touching back to the seed point, (XSeed, YSeed).
  801.             Therefore, only pixels of OldColor are modified and no other
  802.             information is changed.
  803.  
  804.             SEE ALSO
  805.  
  806.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  807.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  808.             SETVIEW
  809.  
  810.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  811.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  812.             IF WHICHVGA = 0 THEN STOP
  813.             DUMMY=RES640
  814.             SETVIEW 100, 100, 539, 379
  815.             FILLVIEW 10
  816.             WHILE INKEY$ = ""
  817.             WEND
  818.             VIDEOMODESET VMODE
  819.             END
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.                                                                          63
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.           FONTGETINFO
  844.  
  845.             PROTOTYPE
  846.  
  847.             SUB FONTGETINFO (Width%, Height%)
  848.  
  849.             INPUT
  850.  
  851.             no input parameters
  852.     WEND
  853.             MOUSEEXIT
  854.             VIDEOMODESET VMODE
  855.             END
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.                                                                          86
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.           MOUSECURSORDEFAULT
  904.  
  905.             PROTOTYPE
  906.  
  907.             SUB MOUSECURSORDEFAULT ()
  908.  
  909.             INPUT
  910.  
  911.             no input parameters
  912.  
  913.             OUTPUT
  914.  
  915.             no value returned
  916.  
  917.             USAGE
  918.  
  919.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  920.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  921. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  922. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  923. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  924. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  925. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  926. $╤
  927. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  928. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  929. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  930. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  931. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  932. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  933. ░£▒
  934. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  935. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  936.       end;
  937.     end;
  938.   end;
  939.   WaitToGo;
  940. end; { UserLineStylePlay }
  941.  
  942.  
  943. procedure SayGoodbye;
  944. { Say goodbye and then exit the program }
  945. var
  946.   ViewInfo : ViewPortType;
  947. begin
  948.   MainWindow('');
  949.   GetViewSettings(ViewInfo);
  950.   SetTextStyle(TriplexFont, HorizDir, 4);
  951.   SetTextJustify(CenterText, CenterText);
  952.   with ViewInfo do
  953.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  954.   StatusLine('Press any key to quit...');
  955.   repeat until KeyPressed;
  956. end; { SayGoodbye }
  957.  
  958.  
  959. PROCEDURE SelectMode;
  960. VAR
  961.     choice1,choice2     : CHAR;
  962.    xsize,ysize            : WORD;
  963. BEGIN
  964.     (* Let's select a mode *)
  965.     ClrScr;
  966.     WriteLn('VESADEMO:');
  967.     WriteLn('1. 256 colors');
  968.     WriteLn('2. 32768 colors');
  969.     WriteLn('3. 65536 colors');
  970.     WriteLn('4. 16777216 colors');
  971.     WriteLn('Q uit');
  972.     WriteLn;
  973.     Write('Your choice: ');
  974.     REPEAT
  975.         ReadLn(choice1);
  976.       IF choice1 <> '1' THEN BEGIN
  977.           WriteLn('Sorry !');
  978.          WriteLn('This demo wasn''t written for more as 256 colors !');
  979.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  980.          WriteLn('Switching to 256 colors.');
  981.          choice1 := '1';
  982.       END;
  983.     UNTIL choice1 IN ['1'..'4','q'];
  984.     IF choice1 = 'q' THEN Halt;
  985.  
  986.     WriteLn;
  987.     WriteLn;
  988.     WriteLn('a. 320x200');
  989.     WriteLn('b. 640x480');
  990.     WriteLn('c. 800x600');
  991.     WriteLn('d. 1024x768');
  992.     WriteLn('e. 1280x1024');
  993.     WriteLn('Q uit');
  994.     WriteLn;
  995.     Write('Your choice: ');
  996.     REPEAT
  997.         ReadLn(choice2);
  998.     UNTIL choice2 IN ['a'..'e','q'];
  999.     IF choice2 = 'q' THEN Halt;
  1000.  
  1001.     CASE choice2 OF
  1002.         'a' : BEGIN
  1003.             xsize := 320;
  1004.             ysize := 200;
  1005.         END;
  1006.         'b' : BEGIN
  1007.             xsize := 640;
  1008.             ysize := 480;
  1009.         END;
  1010.         'c' : BEGIN
  1011.             xsize := 800;
  1012.             ysize := 600;
  1013.         END;
  1014.         'd' : BEGIN
  1015.             xsize := 1024;
  1016.             ysize := 768;
  1017.         END;
  1018.         'e' : BEGIN
  1019.             xsize := 1280;
  1020.             ysize := 1024;
  1021.         END;
  1022.     END;
  1023.     CASE choice1 OF
  1024.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1025.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1026.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1027.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1028.     END;
  1029.     IF mode = 0 THEN BEGIN
  1030.         WriteLn('No such mode could be found !');
  1031.         WriteLn('Switching to to 320x200.');
  1032.         ReadKey;
  1033.         mode := V320x200x256;
  1034.     END;
  1035. END;
  1036.  
  1037. begin { program body }
  1038.   SelectMode;
  1039.   Initialize;
  1040.   ReportStatus;
  1041.  
  1042. {  AspectRatioPlay; }
  1043.   FillEllipsePlay;
  1044.   SectorPlay;
  1045.   WriteModePlay;
  1046.  
  1047.   ColorPlay;
  1048.   { PalettePlay only intended to work on these drivers: }
  1049.   if (GraphDriver = EGA) or
  1050.       (GraphDriver = EGA64) or
  1051.       (GraphDriver = VGA) then
  1052.      PalettePlay;
  1053.   PutPixelPlay;
  1054. {  PutImagePlay; }
  1055.   RandBarPlay;
  1056.   BarPlay;
  1057.   Bar3DPlay;
  1058.   ArcPlay;
  1059.   CirclePlay;
  1060.   PiePlay;
  1061.   LineToPlay;
  1062.   LineRelPlay;
  1063. {  LineStylePlay; }
  1064. {  UserLineStylePlay; }
  1065.   TextDump;
  1066.   TextPlay;
  1067.   CrtModePlay;
  1068.   FillStylePlay;
  1069.   FillPatternPlay;
  1070.   PolyPlay;
  1071.   SayGoodbye;
  1072. {  CloseGraph; }
  1073.   CloseVesa;
  1074. end.
  1075. ***************************************************
  1076.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1077.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1078. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1079. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1080. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1081. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1082.     Color := RandColor;
  1083.     SetColor(Color);
  1084.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1085.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1086.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1087.   until KeyPressed;
  1088.   WaitToGo;
  1089. end; { RandBarPlay }
  1090.  
  1091. procedure ArcPlay;
  1092. { Draw random arcs on the screen }
  1093. var
  1094.   MaxRadius : word;
  1095.   EndAngle : word;
  1096.   ArcInfo : ArcCoordsType;
  1097. begin
  1098.   MainWindow('Arc / GetArcCoords demonstration');
  1099.   StatusLine('Esc aborts or press a key');
  1100.   MaxRadius := MaxY div 10;
  1101.   repeat
  1102.     SetColor(RandColor);
  1103.     EndAngle := Random(360);
  1104.     SetLineStyle(SolidLn, 0, NormWidth);
  1105.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1106.     GetArcCoords(ArcInfo);
  1107.     with ArcInfo do
  1108.     begin
  1109.       Line(X, Y, XStart, YStart);
  1110.       Line(X, Y, Xend, Yend);
  1111.     end;
  1112.   until KeyPressed;
  1113.   WaitToGo;
  1114. end; { ArcPlay }
  1115.  
  1116. procedure PutPixelPlay;
  1117. { Demonstrate the PutPixel and GetPixel commands }
  1118. const
  1119.   Seed   = 1962; { A seed for the random number generator }
  1120.   NumPts = 2000; { The number of pixels plotted }
  1121.   Esc    = #27;
  1122. var
  1123.   I : word;
  1124.   X, Y, Color : word;
  1125.   XMax, YMax  : integer;
  1126.   ViewInfo    : ViewPortType;
  1127. begin
  1128.   MainWindow('PutPixel / GetPixel demonstration');
  1129.   StatusLine('Esc aborts or press a key...');
  1130.  
  1131.   GetViewSettings(ViewInfo);
  1132.   with ViewInfo do
  1133.   begin
  1134.     XMax := (x2-x1-1);
  1135.     YMax := (y2-y1-1);
  1136.   end;
  1137.  
  1138.   while not KeyPressed do
  1139.   begin
  1140.     { Plot random pixels }
  1141.     RandSeed := Seed;
  1142.     I := 0;
  1143.     while (not KeyPressed) and (I < NumPts) do
  1144.     begin
  1145.       Inc(I);
  1146.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1147.     end;
  1148.  
  1149.     { Erase pixels }
  1150.     RandSeed := Seed;
  1151.     I := 0;
  1152.     while (not KeyPressed) and (I < NumPts) do
  1153.     begin
  1154.       Inc(I);
  1155.       X := Random(XMax)+1;
  1156.       Y := Random(YMax)+1;
  1157.       Color := GetPixel(X, Y);
  1158.         if Color = RandColor then
  1159.           PutPixel(X, Y, 0);
  1160.      end;
  1161.   end;
  1162.   WaitToGo;
  1163. end; { PutPixelPlay }
  1164.  
  1165. procedure PutImagePlay;
  1166. { Demonstrate the GetImage and PutImage commands }
  1167.  
  1168. const
  1169.   r  = 20;
  1170.   StartX = 100;
  1171.   StartY = 50;
  1172.  
  1173. var
  1174.   CurPort : ViewPortType;
  1175.  
  1176. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1177. var
  1178.   Step : integer;
  1179. begin
  1180.   Step := Random(2*r);
  1181.   if Odd(Step) then
  1182.     Step := -Step;
  1183.   X := X + Step;
  1184.   Step := Random(r);
  1185.   if Odd(Step) then
  1186.     Step := -Step;
  1187.   Y := Y + Step;
  1188.  
  1189.   { Make saucer bounce off viewport walls }
  1190.   with CurPort do
  1191.   begin
  1192.     if (x1 + X + Width - 1 > x2) then
  1193.       X := x2-x1 - Width + 1
  1194.     else
  1195.       if (X < 0) then
  1196.         X := 0;
  1197.     if (y1 + Y + Height - 1 > y2) then
  1198.       Y := y2-y1 - Height + 1
  1199.     else
  1200.       if (Y < 0) then
  1201.         Y := 0;
  1202.   end;
  1203. end; { MoveSaucer }
  1204.  
  1205. var
  1206.   Pausetime : word;
  1207.   Saucer    : pointer;
  1208.   X, Y      : integer;
  1209.   ulx, uly  : word;
  1210.   lrx, lry  : word;
  1211.   Size      : word;
  1212.   I         : word;
  1213. begin
  1214.   ClearDevice;
  1215.   FullPort;
  1216.  
  1217.   { PaintScreen }
  1218.   ClearDevice;
  1219.   MainWindow('GetImage / PutImage Demonstration');
  1220.   StatusLine('Esc aborts or press a key...');
  1221.   GetViewSettings(CurPort);
  1222.  
  1223.   { DrawSaucer }
  1224.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1225.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1226.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1227.   Circle(StartX+10, StartY-12, 2);
  1228.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1229.   Circle(StartX-10, StartY-12, 2);
  1230.   SetFillStyle(SolidFill, MaxColor);
  1231.   FloodFill(StartX+1, StartY+4, GetColor);
  1232.  
  1233.   { ReadSaucerImage }
  1234.   ulx := StartX-(r+1);
  1235.   uly := StartY-14;
  1236.   lrx := StartX+(r+1);
  1237.   lry := StartY+(r div 3)+3;
  1238.  
  1239.   Size := ImageSize(ulx, uly, lrx, lry);
  1240.   GetMem(Saucer, Size);
  1241.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1242. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1243.  
  1244.   { Plot some "stars" }
  1245.   for I := 1 to 1000 do
  1246.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1247.   X := MaxX div 2;
  1248.   Y := MaxY div 2;
  1249.   PauseTime := 70;
  1250.  
  1251.   { Move the saucer around }
  1252.   repeat
  1253. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1254.      Delay(PauseTime);
  1255. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1256.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1257.   until KeyPressed;
  1258.   FreeMem(Saucer, size);
  1259.   WaitToGo;
  1260. end; { PutImagePlay }
  1261.  
  1262. procedure PolyPlay;
  1263. { Draw random polygons with random fill styles on the screen }
  1264. const
  1265.   MaxPts = 5;
  1266. type
  1267.   PolygonType = array[1..MaxPts] of PointType;
  1268. var
  1269.   Poly : PolygonType;
  1270.   I, Color : word;
  1271. begin
  1272.   MainWindow('FillPoly demonstration');
  1273.   StatusLine('Esc aborts or press a key...');
  1274.   repeat
  1275.     Color := RandColor;
  1276.     SetFillStyle(Random(11)+1, Color);
  1277.     SetColor(Color);
  1278.     for I := 1 to MaxPts do
  1279.       with Poly[I] do
  1280.       begin
  1281.         X := Random(MaxX);
  1282.         Y := Random(MaxY);
  1283.       end;
  1284.     FillPoly(MaxPts, Poly);
  1285.   until KeyPressed;
  1286.   WaitToGo;
  1287. end; { PolyPlay }
  1288.  
  1289. procedure FillStylePlay;
  1290. { Display all of the predefined fill styles available }
  1291. var
  1292.   Style    : word;
  1293.   Width    : word;
  1294.   Height   : word;
  1295.   X, Y     : word;
  1296.   I, J     : word;
  1297.   ViewInfo : ViewPortType;
  1298.  
  1299. procedure DrawBox(X, Y : word);
  1300. begin
  1301.   SetFillStyle(Style, MaxColor);
  1302.   with ViewInfo do
  1303.     Bar(X, Y, X+Width, Y+Height);
  1304.   Rectangle(X, Y, X+Width, Y+Height);
  1305.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1306.   Inc(Style);
  1307. end; { DrawBox }
  1308.  
  1309. begin
  1310.   MainWindow('Pre-defined fill styles');
  1311.   GetViewSettings(ViewInfo);
  1312.   with ViewInfo do
  1313.   begin
  1314.     Width := 2 * ((x2+1) div 13);
  1315.     Height := 2 * ((y2-10) div 10);
  1316.   end;
  1317.   X := Width div 2;
  1318.   Y := Height div 2;
  1319.   Style := 0;
  1320.   for J := 1 to 3 do
  1321.   begin
  1322.     for I := 1 to 4 do
  1323.     begin
  1324.       DrawBox(X, Y);
  1325.       Inc(X, (Width div 2) * 3);
  1326.     end;
  1327.     X := Width div 2;
  1328.     Inc(Y, (Height div 2) * 3);
  1329.   end;
  1330.   SetTextJustify(LeftText, TopText);
  1331.   WaitToGo;
  1332. end; { FillStylePlay }
  1333.  
  1334. procedure FillPatternPlay;
  1335. { Display some user defined fill patterns }
  1336. const
  1337.   Patterns : array[0..11] of FillPatternType = (
  1338.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1339.             OldColor which has a path of pixels of OldColor or NewColor
  1340.             with sides touching back to the seed point, (XSeed, YSeed).
  1341.             Therefore, only pixels of OldColor are modified and no other
  1342.             information is changed.
  1343.  
  1344.             SEE ALSO
  1345.  
  1346.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1347.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1348.             SETVIEW
  1349.  
  1350.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1351.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1352.             IF WHICHVGA = 0 THEN STOP
  1353.             DUMMY=RES640
  1354.             SETVIEW 100, 100, 539, 379
  1355.             FILLVIEW 10
  1356.             WHILE INKEY$ = ""
  1357.             WEND
  1358.             VIDEOMODESET VMODE
  1359.             END
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.                                                                          63
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.           FONTGETINFO
  1384.  
  1385.             PROTOTYPE
  1386.  
  1387.             SUB FONTGETINFO (Width%, Height%)
  1388.  
  1389.             INPUT
  1390.  
  1391.             no input parameters
  1392.     WEND
  1393.             MOUSEEXIT
  1394.             VIDEOMODESET VMODE
  1395.             END
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.                                                                          86
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.           MOUSECURSORDEFAULT
  1444.  
  1445.             PROTOTYPE
  1446.  
  1447.             SUB MOUSECURSORDEFAULT ()
  1448.  
  1449.             INPUT
  1450.  
  1451.             no input parameters
  1452.  
  1453.             OUTPUT
  1454.  
  1455.             no value returned
  1456.  
  1457.             USAGE
  1458.  
  1459.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1460.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1461. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1462. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1463. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1464. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1465. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1466. $╤
  1467. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1468. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1469. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1470. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1471. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1472. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1473. ░£▒
  1474. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1475. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1476.       end;
  1477.     end;
  1478.   end;
  1479.   WaitToGo;
  1480. end; { UserLineStylePlay }
  1481.  
  1482.  
  1483. procedure SayGoodbye;
  1484. { Say goodbye and then exit the program }
  1485. var
  1486.   ViewInfo : ViewPortType;
  1487. begin
  1488.   MainWindow('');
  1489.   GetViewSettings(ViewInfo);
  1490.   SetTextStyle(TriplexFont, HorizDir, 4);
  1491.   SetTextJustify(CenterText, CenterText);
  1492.   with ViewInfo do
  1493.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1494.   StatusLine('Press any key to quit...');
  1495.   repeat until KeyPressed;
  1496. end; { SayGoodbye }
  1497.  
  1498.  
  1499. PROCEDURE SelectMode;
  1500. VAR
  1501.     choice1,choice2     : CHAR;
  1502.    xsize,ysize            : WORD;
  1503. BEGIN
  1504.     (* Let's select a mode *)
  1505.     ClrScr;
  1506.     WriteLn('VESADEMO:');
  1507.     WriteLn('1. 256 colors');
  1508.     WriteLn('2. 32768 colors');
  1509.     WriteLn('3. 65536 colors');
  1510.     WriteLn('4. 16777216 colors');
  1511.     WriteLn('Q uit');
  1512.     WriteLn;
  1513.     Write('Your choice: ');
  1514.     REPEAT
  1515.         ReadLn(choice1);
  1516.       IF choice1 <> '1' THEN BEGIN
  1517.           WriteLn('Sorry !');
  1518.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1519.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1520.          WriteLn('Switching to 256 colors.');
  1521.          choice1 := '1';
  1522.       END;
  1523.     UNTIL choice1 IN ['1'..'4','q'];
  1524.     IF choice1 = 'q' THEN Halt;
  1525.  
  1526.     WriteLn;
  1527.     WriteLn;
  1528.     WriteLn('a. 320x200');
  1529.     WriteLn('b. 640x480');
  1530.     WriteLn('c. 800x600');
  1531.     WriteLn('d. 1024x768');
  1532.     WriteLn('e. 1280x1024');
  1533.     WriteLn('Q uit');
  1534.     WriteLn;
  1535.     Write('Your choice: ');
  1536.     REPEAT
  1537.         ReadLn(choice2);
  1538.     UNTIL choice2 IN ['a'..'e','q'];
  1539.     IF choice2 = 'q' THEN Halt;
  1540.  
  1541.     CASE choice2 OF
  1542.         'a' : BEGIN
  1543.             xsize := 320;
  1544.             ysize := 200;
  1545.         END;
  1546.         'b' : BEGIN
  1547.             xsize := 640;
  1548.             ysize := 480;
  1549.         END;
  1550.         'c' : BEGIN
  1551.             xsize := 800;
  1552.             ysize := 600;
  1553.         END;
  1554.         'd' : BEGIN
  1555.             xsize := 1024;
  1556.             ysize := 768;
  1557.         END;
  1558.         'e' : BEGIN
  1559.             xsize := 1280;
  1560.             ysize := 1024;
  1561.         END;
  1562.     END;
  1563.     CASE choice1 OF
  1564.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1565.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1566.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1567.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1568.     END;
  1569.     IF mode = 0 THEN BEGIN
  1570.         WriteLn('No such mode could be found !');
  1571.         WriteLn('Switching to to 320x200.');
  1572.         ReadKey;
  1573.         mode := V320x200x256;
  1574.     END;
  1575. END;
  1576.  
  1577. begin { program body }
  1578.   SelectMode;
  1579.   Initialize;
  1580.   ReportStatus;
  1581.  
  1582. {  AspectRatioPlay; }
  1583.   FillEllipsePlay;
  1584.   SectorPlay;
  1585.   WriteModePlay;
  1586.  
  1587.   ColorPlay;
  1588.   { PalettePlay only intended to work on these drivers: }
  1589.   if (GraphDriver = EGA) or
  1590.       (GraphDriver = EGA64) or
  1591.       (GraphDriver = VGA) then
  1592.      PalettePlay;
  1593.   PutPixelPlay;
  1594. {  PutImagePlay; }
  1595.   RandBarPlay;
  1596.   BarPlay;
  1597.   Bar3DPlay;
  1598.   ArcPlay;
  1599.   CirclePlay;
  1600.   PiePlay;
  1601.   LineToPlay;
  1602.   LineRelPlay;
  1603. {  LineStylePlay; }
  1604. {  UserLineStylePlay; }
  1605.   TextDump;
  1606.   TextPlay;
  1607.   CrtModePlay;
  1608.   FillStylePlay;
  1609.   FillPatternPlay;
  1610.   PolyPlay;
  1611.   SayGoodbye;
  1612. {  CloseGraph; }
  1613.   CloseVesa;
  1614. end.
  1615. ***************************************************
  1616.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1617.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1618. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1619. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1620. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1621. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1622.     Color := RandColor;
  1623.     SetColor(Color);
  1624.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1625.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1626.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1627.   until KeyPressed;
  1628.   WaitToGo;
  1629. end; { RandBarPlay }
  1630.  
  1631. procedure ArcPlay;
  1632. { Draw random arcs on the screen }
  1633. var
  1634.   MaxRadius : word;
  1635.   EndAngle : word;
  1636.   ArcInfo : ArcCoordsType;
  1637. begin
  1638.   MainWindow('Arc / GetArcCoords demonstration');
  1639.   StatusLine('Esc aborts or press a key');
  1640.   MaxRadius := MaxY div 10;
  1641.   repeat
  1642.     SetColor(RandColor);
  1643.     EndAngle := Random(360);
  1644.     SetLineStyle(SolidLn, 0, NormWidth);
  1645.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1646.     GetArcCoords(ArcInfo);
  1647.     with ArcInfo do
  1648.     begin
  1649.       Line(X, Y, XStart, YStart);
  1650.       Line(X, Y, Xend, Yend);
  1651.     end;
  1652.   until KeyPressed;
  1653.   WaitToGo;
  1654. end; { ArcPlay }
  1655.  
  1656. procedure PutPixelPlay;
  1657. { Demonstrate the PutPixel and GetPixel commands }
  1658. const
  1659.   Seed   = 1962; { A seed for the random number generator }
  1660.   NumPts = 2000; { The number of pixels plotted }
  1661.   Esc    = #27;
  1662. var
  1663.   I : word;
  1664.   X, Y, Color : word;
  1665.   XMax, YMax  : integer;
  1666.   ViewInfo    : ViewPortType;
  1667. begin
  1668.   MainWindow('PutPixel / GetPixel demonstration');
  1669.   StatusLine('Esc aborts or press a key...');
  1670.  
  1671.   GetViewSettings(ViewInfo);
  1672.   with ViewInfo do
  1673.   begin
  1674.     XMax := (x2-x1-1);
  1675.     YMax := (y2-y1-1);
  1676.   end;
  1677.  
  1678.   while not KeyPressed do
  1679.   begin
  1680.     { Plot random pixels }
  1681.     RandSeed := Seed;
  1682.     I := 0;
  1683.     while (not KeyPressed) and (I < NumPts) do
  1684.     begin
  1685.       Inc(I);
  1686.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1687.     end;
  1688.  
  1689.     { Erase pixels }
  1690.     RandSeed := Seed;
  1691.     I := 0;
  1692.     while (not KeyPressed) and (I < NumPts) do
  1693.     begin
  1694.       Inc(I);
  1695.       X := Random(XMax)+1;
  1696.       Y := Random(YMax)+1;
  1697.       Color := GetPixel(X, Y);
  1698.         if Color = RandColor then
  1699.           PutPixel(X, Y, 0);
  1700.      end;
  1701.   end;
  1702.   WaitToGo;
  1703. end; { PutPixelPlay }
  1704.  
  1705. procedure PutImagePlay;
  1706. { Demonstrate the GetImage and PutImage commands }
  1707.  
  1708. const
  1709.   r  = 20;
  1710.   StartX = 100;
  1711.   StartY = 50;
  1712.  
  1713. var
  1714.   CurPort : ViewPortType;
  1715.  
  1716. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1717. var
  1718.   Step : integer;
  1719. begin
  1720.   Step := Random(2*r);
  1721.   if Odd(Step) then
  1722.     Step := -Step;
  1723.   X := X + Step;
  1724.   Step := Random(r);
  1725.   if Odd(Step) then
  1726.     Step := -Step;
  1727.   Y := Y + Step;
  1728.  
  1729.   { Make saucer bounce off viewport walls }
  1730.   with CurPort do
  1731.   begin
  1732.     if (x1 + X + Width - 1 > x2) then
  1733.       X := x2-x1 - Width + 1
  1734.     else
  1735.       if (X < 0) then
  1736.         X := 0;
  1737.     if (y1 + Y + Height - 1 > y2) then
  1738.       Y := y2-y1 - Height + 1
  1739.     else
  1740.       if (Y < 0) then
  1741.         Y := 0;
  1742.   end;
  1743. end; { MoveSaucer }
  1744.  
  1745. var
  1746.   Pausetime : word;
  1747.   Saucer    : pointer;
  1748.   X, Y      : integer;
  1749.   ulx, uly  : word;
  1750.   lrx, lry  : word;
  1751.   Size      : word;
  1752.   I         : word;
  1753. begin
  1754.   ClearDevice;
  1755.   FullPort;
  1756.  
  1757.   { PaintScreen }
  1758.   ClearDevice;
  1759.   MainWindow('GetImage / PutImage Demonstration');
  1760.   StatusLine('Esc aborts or press a key...');
  1761.   GetViewSettings(CurPort);
  1762.  
  1763.   { DrawSaucer }
  1764.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1765.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1766.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1767.   Circle(StartX+10, StartY-12, 2);
  1768.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1769.   Circle(StartX-10, StartY-12, 2);
  1770.   SetFillStyle(SolidFill, MaxColor);
  1771.   FloodFill(StartX+1, StartY+4, GetColor);
  1772.  
  1773.   { ReadSaucerImage }
  1774.   ulx := StartX-(r+1);
  1775.   uly := StartY-14;
  1776.   lrx := StartX+(r+1);
  1777.   lry := StartY+(r div 3)+3;
  1778.  
  1779.   Size := ImageSize(ulx, uly, lrx, lry);
  1780.   GetMem(Saucer, Size);
  1781.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1782. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1783.  
  1784.   { Plot some "stars" }
  1785.   for I := 1 to 1000 do
  1786.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1787.   X := MaxX div 2;
  1788.   Y := MaxY div 2;
  1789.   PauseTime := 70;
  1790.  
  1791.   { Move the saucer around }
  1792.   repeat
  1793. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1794.      Delay(PauseTime);
  1795. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1796.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1797.   until KeyPressed;
  1798.   FreeMem(Saucer, size);
  1799.   WaitToGo;
  1800. end; { PutImagePlay }
  1801.  
  1802. procedure PolyPlay;
  1803. { Draw random polygons with random fill styles on the screen }
  1804. const
  1805.   MaxPts = 5;
  1806. type
  1807.   PolygonType = array[1..MaxPts] of PointType;
  1808. var
  1809.   Poly : PolygonType;
  1810.   I, Color : word;
  1811. begin
  1812.   MainWindow('FillPoly demonstration');
  1813.   StatusLine('Esc aborts or press a key...');
  1814.   repeat
  1815.     Color := RandColor;
  1816.     SetFillStyle(Random(11)+1, Color);
  1817.     SetColor(Color);
  1818.     for I := 1 to MaxPts do
  1819.       with Poly[I] do
  1820.       begin
  1821.         X := Random(MaxX);
  1822.         Y := Random(MaxY);
  1823.       end;
  1824.     FillPoly(MaxPts, Poly);
  1825.   until KeyPressed;
  1826.   WaitToGo;
  1827. end; { PolyPlay }
  1828.  
  1829. procedure FillStylePlay;
  1830. { Display all of the predefined fill styles available }
  1831. var
  1832.   Style    : word;
  1833.   Width    : word;
  1834.   Height   : word;
  1835.   X, Y     : word;
  1836.   I, J     : word;
  1837.   ViewInfo : ViewPortType;
  1838.  
  1839. procedure DrawBox(X, Y : word);
  1840. begin
  1841.   SetFillStyle(Style, MaxColor);
  1842.   with ViewInfo do
  1843.     Bar(X, Y, X+Width, Y+Height);
  1844.   Rectangle(X, Y, X+Width, Y+Height);
  1845.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1846.   Inc(Style);
  1847. end; { DrawBox }
  1848.  
  1849. begin
  1850.   MainWindow('Pre-defined fill styles');
  1851.   GetViewSettings(ViewInfo);
  1852.   with ViewInfo do
  1853.   begin
  1854.     Width := 2 * ((x2+1) div 13);
  1855.     Height := 2 * ((y2-10) div 10);
  1856.   end;
  1857.   X := Width div 2;
  1858.   Y := Height div 2;
  1859.   Style := 0;
  1860.   for J := 1 to 3 do
  1861.   begin
  1862.     for I := 1 to 4 do
  1863.     begin
  1864.       DrawBox(X, Y);
  1865.       Inc(X, (Width div 2) * 3);
  1866.     end;
  1867.     X := Width div 2;
  1868.     Inc(Y, (Height div 2) * 3);
  1869.   end;
  1870.   SetTextJustify(LeftText, TopText);
  1871.   WaitToGo;
  1872. end; { FillStylePlay }
  1873.  
  1874. procedure FillPatternPlay;
  1875. { Display some user defined fill patterns }
  1876. const
  1877.   Patterns : array[0..11] of FillPatternType = (
  1878.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1879.             OldColor which has a path of pixels of OldColor or NewColor
  1880.             with sides touching back to the seed point, (XSeed, YSeed).
  1881.             Therefore, only pixels of OldColor are modified and no other
  1882.             information is changed.
  1883.  
  1884.             SEE ALSO
  1885.  
  1886.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1887.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1888.             SETVIEW
  1889.  
  1890.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1891.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1892.             IF WHICHVGA = 0 THEN STOP
  1893.             DUMMY=RES640
  1894.             SETVIEW 100, 100, 539, 379
  1895.             FILLVIEW 10
  1896.             WHILE INKEY$ = ""
  1897.             WEND
  1898.             VIDEOMODESET VMODE
  1899.             END
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.                                                                          63
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.           FONTGETINFO
  1924.  
  1925.             PROTOTYPE
  1926.  
  1927.             SUB FONTGETINFO (Width%, Height%)
  1928.  
  1929.             INPUT
  1930.  
  1931.             no input parameters
  1932.     WEND
  1933.             MOUSEEXIT
  1934.             VIDEOMODESET VMODE
  1935.             END
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.                                                                          86
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.           MOUSECURSORDEFAULT
  1984.  
  1985.             PROTOTYPE
  1986.  
  1987.             SUB MOUSECURSORDEFAULT ()
  1988.  
  1989.             INPUT
  1990.  
  1991.             no input parameters
  1992.  
  1993.             OUTPUT
  1994.  
  1995.             no value returned
  1996.  
  1997.             USAGE
  1998.  
  1999.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  2000.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  2001. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  2002. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  2003. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  2004. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  2005. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  2006. $╤
  2007. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  2008. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  2009. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  2010. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  2011. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  2012. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  2013. ░£▒
  2014. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  2015. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  2016.       end;
  2017.     end;
  2018.   end;
  2019.   WaitToGo;
  2020. end; { UserLineStylePlay }
  2021.  
  2022.  
  2023. procedure SayGoodbye;
  2024. { Say goodbye and then exit the program }
  2025. var
  2026.   ViewInfo : ViewPortType;
  2027. begin
  2028.   MainWindow('');
  2029.   GetViewSettings(ViewInfo);
  2030.   SetTextStyle(TriplexFont, HorizDir, 4);
  2031.   SetTextJustify(CenterText, CenterText);
  2032.   with ViewInfo do
  2033.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  2034.   StatusLine('Press any key to quit...');
  2035.   repeat until KeyPressed;
  2036. end; { SayGoodbye }
  2037.  
  2038.  
  2039. PROCEDURE SelectMode;
  2040. VAR
  2041.     choice1,choice2     : CHAR;
  2042.    xsize,ysize            : WORD;
  2043. BEGIN
  2044.     (* Let's select a mode *)
  2045.     ClrScr;
  2046.     WriteLn('VESADEMO:');
  2047.     WriteLn('1. 256 colors');
  2048.     WriteLn('2. 32768 colors');
  2049.     WriteLn('3. 65536 colors');
  2050.     WriteLn('4. 16777216 colors');
  2051.     WriteLn('Q uit');
  2052.     WriteLn;
  2053.     Write('Your choice: ');
  2054.     REPEAT
  2055.         ReadLn(choice1);
  2056.       IF choice1 <> '1' THEN BEGIN
  2057.           WriteLn('Sorry !');
  2058.          WriteLn('This demo wasn''t written for more as 256 colors !');
  2059.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  2060.          WriteLn('Switching to 256 colors.');
  2061.          choice1 := '1';
  2062.       END;
  2063.     UNTIL choice1 IN ['1'..'4','q'];
  2064.     IF choice1 = 'q' THEN Halt;
  2065.  
  2066.     WriteLn;
  2067.     WriteLn;
  2068.     WriteLn('a. 320x200');
  2069.     WriteLn('b. 640x480');
  2070.     WriteLn('c. 800x600');
  2071.     WriteLn('d. 1024x768');
  2072.     WriteLn('e. 1280x1024');
  2073.     WriteLn('Q uit');
  2074.     WriteLn;
  2075.     Write('Your choice: ');
  2076.     REPEAT
  2077.         ReadLn(choice2);
  2078.     UNTIL choice2 IN ['a'..'e','q'];
  2079.     IF choice2 = 'q' THEN Halt;
  2080.  
  2081.     CASE choice2 OF
  2082.         'a' : BEGIN
  2083.             xsize := 320;
  2084.             ysize := 200;
  2085.         END;
  2086.         'b' : BEGIN
  2087.             xsize := 640;
  2088.             ysize := 480;
  2089.         END;
  2090.         'c' : BEGIN
  2091.             xsize := 800;
  2092.             ysize := 600;
  2093.         END;
  2094.         'd' : BEGIN
  2095.             xsize := 1024;
  2096.             ysize := 768;
  2097.         END;
  2098.         'e' : BEGIN
  2099.             xsize := 1280;
  2100.             ysize := 1024;
  2101.         END;
  2102.     END;
  2103.     CASE choice1 OF
  2104.         '1' : mode := FindVesaMode(xsize,ysize,8);
  2105.         '2' : mode := FindVesaMode(xsize,ysize,15);
  2106.         '3' : mode := FindVesaMode(xsize,ysize,16);
  2107.         '4' : mode := FindVesaMode(xsize,ysize,24);
  2108.     END;
  2109.     IF mode = 0 THEN BEGIN
  2110.         WriteLn('No such mode could be found !');
  2111.         WriteLn('Switching to to 320x200.');
  2112.         ReadKey;
  2113.         mode := V320x200x256;
  2114.     END;
  2115. END;
  2116.  
  2117. begin { program body }
  2118.   SelectMode;
  2119.   Initialize;
  2120.   ReportStatus;
  2121.  
  2122. {  AspectRatioPlay; }
  2123.   FillEllipsePlay;
  2124.   SectorPlay;
  2125.   WriteModePlay;
  2126.  
  2127.   ColorPlay;
  2128.   { PalettePlay only intended to work on these drivers: }
  2129.   if (GraphDriver = EGA) or
  2130.       (GraphDriver = EGA64) or
  2131.       (GraphDriver = VGA) then
  2132.      PalettePlay;
  2133.   PutPixelPlay;
  2134. {  PutImagePlay; }
  2135.   RandBarPlay;
  2136.   BarPlay;
  2137.   Bar3DPlay;
  2138.   ArcPlay;
  2139.   CirclePlay;
  2140.   PiePlay;
  2141.   LineToPlay;
  2142.   LineRelPlay;
  2143. {  LineStylePlay; }
  2144. {  UserLineStylePlay; }
  2145.   TextDump;
  2146.   TextPlay;
  2147.   CrtModePlay;
  2148.   FillStylePlay;
  2149.   FillPatternPlay;
  2150.   PolyPlay;
  2151.   SayGoodbye;
  2152. {  CloseGraph; }
  2153.   CloseVesa;
  2154. end.
  2155. ***************************************************
  2156.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  2157.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  2158. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  2159. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  2160. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  2161. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  2162.     Color := RandColor;
  2163.     SetColor(Color);
  2164.     SetFillStyle(Random(CloseDotFill)+1, Color);
  2165.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  2166.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  2167.   until KeyPressed;
  2168.   WaitToGo;
  2169. end; { RandBarPlay }
  2170.  
  2171. procedure ArcPlay;
  2172. { Draw random arcs on the screen }
  2173. var
  2174.   MaxRadius : word;
  2175.   EndAngle : word;
  2176.   ArcInfo : ArcCoordsType;
  2177. begin
  2178.   MainWindow('Arc / GetArcCoords demonstration');
  2179.   StatusLine('Esc aborts or press a key');
  2180.   MaxRadius := MaxY div 10;
  2181.   repeat
  2182.     SetColor(RandColor);
  2183.     EndAngle := Random(360);
  2184.     SetLineStyle(SolidLn, 0, NormWidth);
  2185.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  2186.     GetArcCoords(ArcInfo);
  2187.     with ArcInfo do
  2188.     begin
  2189.       Line(X, Y, XStart, YStart);
  2190.       Line(X, Y, Xend, Yend);
  2191.     end;
  2192.   until KeyPressed;
  2193.   WaitToGo;
  2194. end; { ArcPlay }
  2195.  
  2196. procedure PutPixelPlay;
  2197. { Demonstrate the PutPixel and GetPixel commands }
  2198. const
  2199.   Seed   = 1962; { A seed for the random number generator }
  2200.   NumPts = 2000; { The number of pixels plotted }
  2201.   Esc    = #27;
  2202. var
  2203.   I : word;
  2204.   X, Y, Color : word;
  2205.   XMax, YMax  : integer;
  2206.   ViewInfo    : ViewPortType;
  2207. begin
  2208.   MainWindow('PutPixel / GetPixel demonstration');
  2209.   StatusLine('Esc aborts or press a key...');
  2210.  
  2211.   GetViewSettings(ViewInfo);
  2212.   with ViewInfo do
  2213.   begin
  2214.     XMax := (x2-x1-1);
  2215.     YMax := (y2-y1-1);
  2216.   end;
  2217.  
  2218.   while not KeyPressed do
  2219.   begin
  2220.     { Plot random pixels }
  2221.     RandSeed := Seed;
  2222.     I := 0;
  2223.     while (not KeyPressed) and (I < NumPts) do
  2224.     begin
  2225.       Inc(I);
  2226.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  2227.     end;
  2228.  
  2229.     { Erase pixels }
  2230.     RandSeed := Seed;
  2231.     I := 0;
  2232.     while (not KeyPressed) and (I < NumPts) do
  2233.     begin
  2234.       Inc(I);
  2235.       X := Random(XMax)+1;
  2236.       Y := Random(YMax)+1;
  2237.       Color := GetPixel(X, Y);
  2238.         if Color = RandColor then
  2239.           PutPixel(X, Y, 0);
  2240.      end;
  2241.   end;
  2242.   WaitToGo;
  2243. end; { PutPixelPlay }
  2244.  
  2245. procedure PutImagePlay;
  2246. { Demonstrate the GetImage and PutImage commands }
  2247.  
  2248. const
  2249.   r  = 20;
  2250.   StartX = 100;
  2251.   StartY = 50;
  2252.  
  2253. var
  2254.   CurPort : ViewPortType;
  2255.  
  2256. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  2257. var
  2258.   Step : integer;
  2259. begin
  2260.   Step := Random(2*r);
  2261.   if Odd(Step) then
  2262.     Step := -Step;
  2263.   X := X + Step;
  2264.   Step := Random(r);
  2265.   if Odd(Step) then
  2266.     Step := -Step;
  2267.   Y := Y + Step;
  2268.  
  2269.   { Make saucer bounce off viewport walls }
  2270.   with CurPort do
  2271.   begin
  2272.     if (x1 + X + Width - 1 > x2) then
  2273.       X := x2-x1 - Width + 1
  2274.     else
  2275.       if (X < 0) then
  2276.         X := 0;
  2277.     if (y1 + Y + Height - 1 > y2) then
  2278.       Y := y2-y1 - Height + 1
  2279.     else
  2280.       if (Y < 0) then
  2281.         Y := 0;
  2282.   end;
  2283. end; { MoveSaucer }
  2284.  
  2285. var
  2286.   Pausetime : word;
  2287.   Saucer    : pointer;
  2288.   X, Y      : integer;
  2289.   ulx, uly  : word;
  2290.   lrx, lry  : word;
  2291.   Size      : word;
  2292.   I         : word;
  2293. begin
  2294.   ClearDevice;
  2295.   FullPort;
  2296.  
  2297.   { PaintScreen }
  2298.   ClearDevice;
  2299.   MainWindow('GetImage / PutImage Demonstration');
  2300.   StatusLine('Esc aborts or press a key...');
  2301.   GetViewSettings(CurPort);
  2302.  
  2303.   { DrawSaucer }
  2304.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  2305.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  2306.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  2307.   Circle(StartX+10, StartY-12, 2);
  2308.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  2309.   Circle(StartX-10, StartY-12, 2);
  2310.   SetFillStyle(SolidFill, MaxColor);
  2311.   FloodFill(StartX+1, StartY+4, GetColor);
  2312.  
  2313.   { ReadSaucerImage }
  2314.   ulx := StartX-(r+1);
  2315.   uly := StartY-14;
  2316.   lrx := StartX+(r+1);
  2317.   lry := StartY+(r div 3)+3;
  2318.  
  2319.   Size := ImageSize(ulx, uly, lrx, lry);
  2320.   GetMem(Saucer, Size);
  2321.   GetImage(ulx, uly, lrx, lry, Saucer^);
  2322. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  2323.  
  2324.   { Plot some "stars" }
  2325.   for I := 1 to 1000 do
  2326.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  2327.   X := MaxX div 2;
  2328.   Y := MaxY div 2;
  2329.   PauseTime := 70;
  2330.  
  2331.   { Move the saucer around }
  2332.   repeat
  2333. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  2334.      Delay(PauseTime);
  2335. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  2336.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  2337.   until KeyPressed;
  2338.   FreeMem(Saucer, size);
  2339.   WaitToGo;
  2340. end; { PutImagePlay }
  2341.  
  2342. procedure PolyPlay;
  2343. { Draw random polygons with random fill styles on the screen }
  2344. const
  2345.   MaxPts = 5;
  2346. type
  2347.   PolygonType = array[1..MaxPts] of PointType;
  2348. var
  2349.   Poly : PolygonType;
  2350.   I, Color : word;
  2351. begin
  2352.   MainWindow('FillPoly demonstration');
  2353.   StatusLine('Esc aborts or press a key...');
  2354.   repeat
  2355.     Color := RandColor;
  2356.     SetFillStyle(Random(11)+1, Color);
  2357.     SetColor(Color);
  2358.     for I := 1 to MaxPts do
  2359.       with Poly[I] do
  2360.       begin
  2361.         X := Random(MaxX);
  2362.         Y := Random(MaxY);
  2363.       end;
  2364.     FillPoly(MaxPts, Poly);
  2365.   until KeyPressed;
  2366.   WaitToGo;
  2367. end; { PolyPlay }
  2368.  
  2369. procedure FillStylePlay;
  2370. { Display all of the predefined fill styles available }
  2371. var
  2372.   Style    : word;
  2373.   Width    : word;
  2374.   Height   : word;
  2375.   X, Y     : word;
  2376.   I, J     : word;
  2377.   ViewInfo : ViewPortType;
  2378.  
  2379. procedure DrawBox(X, Y : word);
  2380. begin
  2381.   SetFillStyle(Style, MaxColor);
  2382.   with ViewInfo do
  2383.     Bar(X, Y, X+Width, Y+Height);
  2384.   Rectangle(X, Y, X+Width, Y+Height);
  2385.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  2386.   Inc(Style);
  2387. end; { DrawBox }
  2388.  
  2389. begin
  2390.   MainWindow('Pre-defined fill styles');
  2391.   GetViewSettings(ViewInfo);
  2392.   with ViewInfo do
  2393.   begin
  2394.     Width := 2 * ((x2+1) div 13);
  2395.     Height := 2 * ((y2-10) div 10);
  2396.   end;
  2397.   X := Width div 2;
  2398.   Y := Height div 2;
  2399.   Style := 0;
  2400.   for J := 1 to 3 do
  2401.   begin
  2402.     for I := 1 to 4 do
  2403.     begin
  2404.       DrawBox(X, Y);
  2405.       Inc(X, (Width div 2) * 3);
  2406.     end;
  2407.     X := Width div 2;
  2408.     Inc(Y, (Height div 2) * 3);
  2409.   end;
  2410.   SetTextJustify(LeftText, TopText);
  2411.   WaitToGo;
  2412. end; { FillStylePlay }
  2413.  
  2414. procedure FillPatternPlay;
  2415. { Display some user defined fill patterns }
  2416. const
  2417.   Patterns : array[0..11] of FillPatternType = (
  2418.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  2419.             OldColor which has a path of pixels of OldColor or NewColor
  2420.             with sides touching back to the seed point, (XSeed, YSeed).
  2421.             Therefore, only pixels of OldColor are modified and no other
  2422.             information is changed.
  2423.  
  2424.             SEE ALSO
  2425.  
  2426.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  2427.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  2428.             SETVIEW
  2429.  
  2430.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  2431.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  2432.             IF WHICHVGA = 0 THEN STOP
  2433.             DUMMY=RES640
  2434.             SETVIEW 100, 100, 539, 379
  2435.             FILLVIEW 10
  2436.             WHILE INKEY$ = ""
  2437.             WEND
  2438.             VIDEOMODESET VMODE
  2439.             END
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.                                                                          63
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.           FONTGETINFO
  2464.  
  2465.             PROTOTYPE
  2466.  
  2467.             SUB FONTGETINFO (Width%, Height%)
  2468.  
  2469.             INPUT
  2470.  
  2471.             no input parameters
  2472.     WEND
  2473.             MOUSEEXIT
  2474.             VIDEOMODESET VMODE
  2475.             END
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.                                                                          86
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.           MOUSECURSORDEFAULT
  2524.  
  2525.             PROTOTYPE
  2526.  
  2527.             SUB MOUSECURSORDEFAULT ()
  2528.  
  2529.             INPUT
  2530.  
  2531.             no input parameters
  2532.  
  2533.             OUTPUT
  2534.  
  2535.             no value returned
  2536.  
  2537.             USAGE
  2538.  
  2539.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  2540.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  2541. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  2542. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  2543. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  2544. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  2545. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  2546. $╤
  2547. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  2548. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  2549. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  2550. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  2551. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  2552. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  2553. ░£▒
  2554. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  2555. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  2556.       end;
  2557.     end;
  2558.   end;
  2559.   WaitToGo;
  2560. end; { UserLineStylePlay }
  2561.  
  2562.  
  2563. procedure SayGoodbye;
  2564. { Say goodbye and then exit the program }
  2565. var
  2566.   ViewInfo : ViewPortType;
  2567. begin
  2568.   MainWindow('');
  2569.   GetViewSettings(ViewInfo);
  2570.   SetTextStyle(TriplexFont, HorizDir, 4);
  2571.   SetTextJustify(CenterText, CenterText);
  2572.   with ViewInfo do
  2573.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  2574.   StatusLine('Press any key to quit...');
  2575.   repeat until KeyPressed;
  2576. end; { SayGoodbye }
  2577.  
  2578.  
  2579. PROCEDURE SelectMode;
  2580. VAR
  2581.     choice1,choice2     : CHAR;
  2582.    xsize,ysize            : WORD;
  2583. BEGIN
  2584.     (* Let's select a mode *)
  2585.     ClrScr;
  2586.     WriteLn('VESADEMO:');
  2587.     WriteLn('1. 256 colors');
  2588.     WriteLn('2. 32768 colors');
  2589.     WriteLn('3. 65536 colors');
  2590.     WriteLn('4. 16777216 colors');
  2591.     WriteLn('Q uit');
  2592.     WriteLn;
  2593.     Write('Your choice: ');
  2594.     REPEAT
  2595.         ReadLn(choice1);
  2596.       IF choice1 <> '1' THEN BEGIN
  2597.           WriteLn('Sorry !');
  2598.          WriteLn('This demo wasn''t written for more as 256 colors !');
  2599.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  2600.          WriteLn('Switching to 256 colors.');
  2601.          choice1 := '1';
  2602.       END;
  2603.     UNTIL choice1 IN ['1'..'4','q'];
  2604.     IF choice1 = 'q' THEN Halt;
  2605.  
  2606.     WriteLn;
  2607.     WriteLn;
  2608.     WriteLn('a. 320x200');
  2609.     WriteLn('b. 640x480');
  2610.     WriteLn('c. 800x600');
  2611.     WriteLn('d. 1024x768');
  2612.     WriteLn('e. 1280x1024');
  2613.     WriteLn('Q uit');
  2614.     WriteLn;
  2615.     Write('Your choice: ');
  2616.     REPEAT
  2617.         ReadLn(choice2);
  2618.     UNTIL choice2 IN ['a'..'e','q'];
  2619.     IF choice2 = 'q' THEN Halt;
  2620.  
  2621.     CASE choice2 OF
  2622.         'a' : BEGIN
  2623.             xsize := 320;
  2624.             ysize := 200;
  2625.         END;
  2626.         'b' : BEGIN
  2627.             xsize := 640;
  2628.             ysize := 480;
  2629.         END;
  2630.         'c' : BEGIN
  2631.             xsize := 800;
  2632.             ysize := 600;
  2633.         END;
  2634.         'd' : BEGIN
  2635.             xsize := 1024;
  2636.             ysize := 768;
  2637.         END;
  2638.         'e' : BEGIN
  2639.             xsize := 1280;
  2640.             ysize := 1024;
  2641.         END;
  2642.     END;
  2643.     CASE choice1 OF
  2644.         '1' : mode := FindVesaMode(xsize,ysize,8);
  2645.         '2' : mode := FindVesaMode(xsize,ysize,15);
  2646.         '3' : mode := FindVesaMode(xsize,ysize,16);
  2647.         '4' : mode := FindVesaMode(xsize,ysize,24);
  2648.     END;
  2649.     IF mode = 0 THEN BEGIN
  2650.         WriteLn('No such mode could be found !');
  2651.         WriteLn('Switching to to 320x200.');
  2652.         ReadKey;
  2653.         mode := V320x200x256;
  2654.     END;
  2655. END;
  2656.  
  2657. begin { program body }
  2658.   SelectMode;
  2659.   Initialize;
  2660.   ReportStatus;
  2661.  
  2662. {  AspectRatioPlay; }
  2663.   FillEllipsePlay;
  2664.   SectorPlay;
  2665.   WriteModePlay;
  2666.  
  2667.   ColorPlay;
  2668.   { PalettePlay only intended to work on these drivers: }
  2669.   if (GraphDriver = EGA) or
  2670.       (GraphDriver = EGA64) or
  2671.       (GraphDriver = VGA) then
  2672.      PalettePlay;
  2673.   PutPixelPlay;
  2674. {  PutImagePlay; }
  2675.   RandBarPlay;
  2676.   BarPlay;
  2677.   Bar3DPlay;
  2678.   ArcPlay;
  2679.   CirclePlay;
  2680.   PiePlay;
  2681.   LineToPlay;
  2682.   LineRelPlay;
  2683. {  LineStylePlay; }
  2684. {  UserLineStylePlay; }
  2685.   TextDump;
  2686.   TextPlay;
  2687.   CrtModePlay;
  2688.   FillStylePlay;
  2689.   FillPatternPlay;
  2690.   PolyPlay;
  2691.   SayGoodbye;
  2692. {  CloseGraph; }
  2693.   CloseVesa;
  2694. end.
  2695. ***************************************************
  2696.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  2697.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  2698. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  2699. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  2700. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  2701. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  2702.     Color := RandColor;
  2703.     SetColor(Color);
  2704.     SetFillStyle(Random(CloseDotFill)+1, Color);
  2705.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  2706.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  2707.   until KeyPressed;
  2708.   WaitToGo;
  2709. end; { RandBarPlay }
  2710.  
  2711. procedure ArcPlay;
  2712. { Draw random arcs on the screen }
  2713. var
  2714.   MaxRadius : word;
  2715.   EndAngle : word;
  2716.   ArcInfo : ArcCoordsType;
  2717. begin
  2718.   MainWindow('Arc / GetArcCoords demonstration');
  2719.   StatusLine('Esc aborts or press a key');
  2720.   MaxRadius := MaxY div 10;
  2721.   repeat
  2722.     SetColor(RandColor);
  2723.     EndAngle := Random(360);
  2724.     SetLineStyle(SolidLn, 0, NormWidth);
  2725.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  2726.     GetArcCoords(ArcInfo);
  2727.     with ArcInfo do
  2728.     begin
  2729.       Line(X, Y, XStart, YStart);
  2730.       Line(X, Y, Xend, Yend);
  2731.     end;
  2732.   until KeyPressed;
  2733.   WaitToGo;
  2734. end; { ArcPlay }
  2735.  
  2736. procedure PutPixelPlay;
  2737. { Demonstrate the PutPixel and GetPixel commands }
  2738. const
  2739.   Seed   = 1962; { A seed for the random number generator }
  2740.   NumPts = 2000; { The number of pixels plotted }
  2741.   Esc    = #27;
  2742. var
  2743.   I : word;
  2744.   X, Y, Color : word;
  2745.   XMax, YMax  : integer;
  2746.   ViewInfo    : ViewPortType;
  2747. begin
  2748.   MainWindow('PutPixel / GetPixel demonstration');
  2749.   StatusLine('Esc aborts or press a key...');
  2750.  
  2751.   GetViewSettings(ViewInfo);
  2752.   with ViewInfo do
  2753.   begin
  2754.     XMax := (x2-x1-1);
  2755.     YMax := (y2-y1-1);
  2756.   end;
  2757.  
  2758.   while not KeyPressed do
  2759.   begin
  2760.     { Plot random pixels }
  2761.     RandSeed := Seed;
  2762.     I := 0;
  2763.     while (not KeyPressed) and (I < NumPts) do
  2764.     begin
  2765.       Inc(I);
  2766.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  2767.     end;
  2768.  
  2769.     { Erase pixels }
  2770.     RandSeed := Seed;
  2771.     I := 0;
  2772.     while (not KeyPressed) and (I < NumPts) do
  2773.     begin
  2774.       Inc(I);
  2775.       X := Random(XMax)+1;
  2776.       Y := Random(YMax)+1;
  2777.       Color := GetPixel(X, Y);
  2778.         if Color = RandColor then
  2779.           PutPixel(X, Y, 0);
  2780.      end;
  2781.   end;
  2782.   WaitToGo;
  2783. end; { PutPixelPlay }
  2784.  
  2785. procedure PutImagePlay;
  2786. { Demonstrate the GetImage and PutImage commands }
  2787.  
  2788. const
  2789.   r  = 20;
  2790.   StartX = 100;
  2791.   StartY = 50;
  2792.  
  2793. var
  2794.   CurPort : ViewPortType;
  2795.  
  2796. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  2797. var
  2798.   Step : integer;
  2799. begin
  2800.   Step := Random(2*r);
  2801.   if Odd(Step) then
  2802.     Step := -Step;
  2803.   X := X + Step;
  2804.   Step := Random(r);
  2805.   if Odd(Step) then
  2806.     Step := -Step;
  2807.   Y := Y + Step;
  2808.  
  2809.   { Make saucer bounce off viewport walls }
  2810.   with CurPort do
  2811.   begin
  2812.     if (x1 + X + Width - 1 > x2) then
  2813.       X := x2-x1 - Width + 1
  2814.     else
  2815.       if (X < 0) then
  2816.         X := 0;
  2817.     if (y1 + Y + Height - 1 > y2) then
  2818.       Y := y2-y1 - Height + 1
  2819.     else
  2820.       if (Y < 0) then
  2821.         Y := 0;
  2822.   end;
  2823. end; { MoveSaucer }
  2824.  
  2825. var
  2826.   Pausetime : word;
  2827.   Saucer    : pointer;
  2828.   X, Y      : integer;
  2829.   ulx, uly  : word;
  2830.   lrx, lry  : word;
  2831.   Size      : word;
  2832.   I         : word;
  2833. begin
  2834.   ClearDevice;
  2835.   FullPort;
  2836.  
  2837.   { PaintScreen }
  2838.   ClearDevice;
  2839.   MainWindow('GetImage / PutImage Demonstration');
  2840.   StatusLine('Esc aborts or press a key...');
  2841.   GetViewSettings(CurPort);
  2842.  
  2843.   { DrawSaucer }
  2844.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  2845.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  2846.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  2847.   Circle(StartX+10, StartY-12, 2);
  2848.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  2849.   Circle(StartX-10, StartY-12, 2);
  2850.   SetFillStyle(SolidFill, MaxColor);
  2851.   FloodFill(StartX+1, StartY+4, GetColor);
  2852.  
  2853.   { ReadSaucerImage }
  2854.   ulx := StartX-(r+1);
  2855.   uly := StartY-14;
  2856.   lrx := StartX+(r+1);
  2857.   lry := StartY+(r div 3)+3;
  2858.  
  2859.   Size := ImageSize(ulx, uly, lrx, lry);
  2860.   GetMem(Saucer, Size);
  2861.   GetImage(ulx, uly, lrx, lry, Saucer^);
  2862. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  2863.  
  2864.   { Plot some "stars" }
  2865.   for I := 1 to 1000 do
  2866.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  2867.   X := MaxX div 2;
  2868.   Y := MaxY div 2;
  2869.   PauseTime := 70;
  2870.  
  2871.   { Move the saucer around }
  2872.   repeat
  2873. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  2874.      Delay(PauseTime);
  2875. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  2876.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  2877.   until KeyPressed;
  2878.   FreeMem(Saucer, size);
  2879.   WaitToGo;
  2880. end; { PutImagePlay }
  2881.  
  2882. procedure PolyPlay;
  2883. { Draw random polygons with random fill styles on the screen }
  2884. const
  2885.   MaxPts = 5;
  2886. type
  2887.   PolygonType = array[1..MaxPts] of PointType;
  2888. var
  2889.   Poly : PolygonType;
  2890.   I, Color : word;
  2891. begin
  2892.   MainWindow('FillPoly demonstration');
  2893.   StatusLine('Esc aborts or press a key...');
  2894.   repeat
  2895.     Color := RandColor;
  2896.     SetFillStyle(Random(11)+1, Color);
  2897.     SetColor(Color);
  2898.     for I := 1 to MaxPts do
  2899.       with Poly[I] do
  2900.       begin
  2901.         X := Random(MaxX);
  2902.         Y := Random(MaxY);
  2903.       end;
  2904.     FillPoly(MaxPts, Poly);
  2905.   until KeyPressed;
  2906.   WaitToGo;
  2907. end; { PolyPlay }
  2908.  
  2909. procedure FillStylePlay;
  2910. { Display all of the predefined fill styles available }
  2911. var
  2912.   Style    : word;
  2913.   Width    : word;
  2914.   Height   : word;
  2915.   X, Y     : word;
  2916.   I, J     : word;
  2917.   ViewInfo : ViewPortType;
  2918.  
  2919. procedure DrawBox(X, Y : word);
  2920. begin
  2921.   SetFillStyle(Style, MaxColor);
  2922.   with ViewInfo do
  2923.     Bar(X, Y, X+Width, Y+Height);
  2924.   Rectangle(X, Y, X+Width, Y+Height);
  2925.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  2926.   Inc(Style);
  2927. end; { DrawBox }
  2928.  
  2929. begin
  2930.   MainWindow('Pre-defined fill styles');
  2931.   GetViewSettings(ViewInfo);
  2932.   with ViewInfo do
  2933.   begin
  2934.     Width := 2 * ((x2+1) div 13);
  2935.     Height := 2 * ((y2-10) div 10);
  2936.   end;
  2937.   X := Width div 2;
  2938.   Y := Height div 2;
  2939.   Style := 0;
  2940.   for J := 1 to 3 do
  2941.   begin
  2942.     for I := 1 to 4 do
  2943.     begin
  2944.       DrawBox(X, Y);
  2945.       Inc(X, (Width div 2) * 3);
  2946.     end;
  2947.     X := Width div 2;
  2948.     Inc(Y, (Height div 2) * 3);
  2949.   end;
  2950.   SetTextJustify(LeftText, TopText);
  2951.   WaitToGo;
  2952. end; { FillStylePlay }
  2953.  
  2954. procedure FillPatternPlay;
  2955. { Display some user defined fill patterns }
  2956. const
  2957.   Patterns : array[0..11] of FillPatternType = (
  2958.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  2959.             OldColor which has a path of pixels of OldColor or NewColor
  2960.             with sides touching back to the seed point, (XSeed, YSeed).
  2961.             Therefore, only pixels of OldColor are modified and no other
  2962.             information is changed.
  2963.  
  2964.             SEE ALSO
  2965.  
  2966.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  2967.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  2968.             SETVIEW
  2969.  
  2970.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  2971.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  2972.             IF WHICHVGA = 0 THEN STOP
  2973.             DUMMY=RES640
  2974.             SETVIEW 100, 100, 539, 379
  2975.             FILLVIEW 10
  2976.             WHILE INKEY$ = ""
  2977.             WEND
  2978.             VIDEOMODESET VMODE
  2979.             END
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.                                                                          63
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.           FONTGETINFO
  3004.  
  3005.             PROTOTYPE
  3006.  
  3007.             SUB FONTGETINFO (Width%, Height%)
  3008.  
  3009.             INPUT
  3010.  
  3011.             no input parameters
  3012.     WEND
  3013.             MOUSEEXIT
  3014.             VIDEOMODESET VMODE
  3015.             END
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.                                                                          86
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.           MOUSECURSORDEFAULT
  3064.  
  3065.             PROTOTYPE
  3066.  
  3067.             SUB MOUSECURSORDEFAULT ()
  3068.  
  3069.             INPUT
  3070.  
  3071.             no input parameters
  3072.  
  3073.             OUTPUT
  3074.  
  3075.             no value returned
  3076.  
  3077.             USAGE
  3078.  
  3079.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  3080.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  3081. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  3082. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  3083. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  3084. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  3085. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  3086. $╤
  3087. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  3088. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  3089. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  3090. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  3091. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  3092. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  3093. ░£▒
  3094. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  3095. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  3096.       end;
  3097.     end;
  3098.   end;
  3099.   WaitToGo;
  3100. end; { UserLineStylePlay }
  3101.  
  3102.  
  3103. procedure SayGoodbye;
  3104. { Say goodbye and then exit the program }
  3105. var
  3106.   ViewInfo : ViewPortType;
  3107. begin
  3108.   MainWindow('');
  3109.   GetViewSettings(ViewInfo);
  3110.   SetTextStyle(TriplexFont, HorizDir, 4);
  3111.   SetTextJustify(CenterText, CenterText);
  3112.   with ViewInfo do
  3113.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  3114.   StatusLine('Press any key to quit...');
  3115.   repeat until KeyPressed;
  3116. end; { SayGoodbye }
  3117.  
  3118.  
  3119. PROCEDURE SelectMode;
  3120. VAR
  3121.     choice1,choice2     : CHAR;
  3122.    xsize,ysize            : WORD;
  3123. BEGIN
  3124.     (* Let's select a mode *)
  3125.     ClrScr;
  3126.     WriteLn('VESADEMO:');
  3127.     WriteLn('1. 256 colors');
  3128.     WriteLn('2. 32768 colors');
  3129.     WriteLn('3. 65536 colors');
  3130.     WriteLn('4. 16777216 colors');
  3131.     WriteLn('Q uit');
  3132.     WriteLn;
  3133.     Write('Your choice: ');
  3134.     REPEAT
  3135.         ReadLn(choice1);
  3136.       IF choice1 <> '1' THEN BEGIN
  3137.           WriteLn('Sorry !');
  3138.          WriteLn('This demo wasn''t written for more as 256 colors !');
  3139.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  3140.          WriteLn('Switching to 256 colors.');
  3141.          choice1 := '1';
  3142.       END;
  3143.     UNTIL choice1 IN ['1'..'4','q'];
  3144.     IF choice1 = 'q' THEN Halt;
  3145.  
  3146.     WriteLn;
  3147.     WriteLn;
  3148.     WriteLn('a. 320x200');
  3149.     WriteLn('b. 640x480');
  3150.     WriteLn('c. 800x600');
  3151.     WriteLn('d. 1024x768');
  3152.     WriteLn('e. 1280x1024');
  3153.     WriteLn('Q uit');
  3154.     WriteLn;
  3155.     Write('Your choice: ');
  3156.     REPEAT
  3157.         ReadLn(choice2);
  3158.     UNTIL choice2 IN ['a'..'e','q'];
  3159.     IF choice2 = 'q' THEN Halt;
  3160.  
  3161.     CASE choice2 OF
  3162.         'a' : BEGIN
  3163.             xsize := 320;
  3164.             ysize := 200;
  3165.         END;
  3166.         'b' : BEGIN
  3167.             xsize := 640;
  3168.             ysize := 480;
  3169.         END;
  3170.         'c' : BEGIN
  3171.             xsize := 800;
  3172.             ysize := 600;
  3173.         END;
  3174.         'd' : BEGIN
  3175.             xsize := 1024;
  3176.             ysize := 768;
  3177.         END;
  3178.         'e' : BEGIN
  3179.             xsize := 1280;
  3180.             ysize := 1024;
  3181.         END;
  3182.     END;
  3183.     CASE choice1 OF
  3184.         '1' : mode := FindVesaMode(xsize,ysize,8);
  3185.         '2' : mode := FindVesaMode(xsize,ysize,15);
  3186.         '3' : mode := FindVesaMode(xsize,ysize,16);
  3187.         '4' : mode := FindVesaMode(xsize,ysize,24);
  3188.     END;
  3189.     IF mode = 0 THEN BEGIN
  3190.         WriteLn('No such mode could be found !');
  3191.         WriteLn('Switching to to 320x200.');
  3192.         ReadKey;
  3193.         mode := V320x200x256;
  3194.     END;
  3195. END;
  3196.  
  3197. begin { program body }
  3198.   SelectMode;
  3199.   Initialize;
  3200.   ReportStatus;
  3201.  
  3202. {  AspectRatioPlay; }
  3203.   FillEllipsePlay;
  3204.   SectorPlay;
  3205.   WriteModePlay;
  3206.  
  3207.   ColorPlay;
  3208.   { PalettePlay only intended to work on these drivers: }
  3209.   if (GraphDriver = EGA) or
  3210.       (GraphDriver = EGA64) or
  3211.       (GraphDriver = VGA) then
  3212.      PalettePlay;
  3213.   PutPixelPlay;
  3214. {  PutImagePlay; }
  3215.   RandBarPlay;
  3216.   BarPlay;
  3217.   Bar3DPlay;
  3218.   ArcPlay;
  3219.   CirclePlay;
  3220.   PiePlay;
  3221.   LineToPlay;
  3222.   LineRelPlay;
  3223. {  LineStylePlay; }
  3224. {  UserLineStylePlay; }
  3225.   TextDump;
  3226.   TextPlay;
  3227.   CrtModePlay;
  3228.   FillStylePlay;
  3229.   FillPatternPlay;
  3230.   PolyPlay;
  3231.   SayGoodbye;
  3232. {  CloseGraph; }
  3233.   CloseVesa;
  3234. end.
  3235. ***************************************************
  3236.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  3237.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  3238. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  3239. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  3240. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  3241. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  3242.     Color := RandColor;
  3243.     SetColor(Color);
  3244.     SetFillStyle(Random(CloseDotFill)+1, Color);
  3245.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  3246.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  3247.   until KeyPressed;
  3248.   WaitToGo;
  3249. end; { RandBarPlay }
  3250.  
  3251. procedure ArcPlay;
  3252. { Draw random arcs on the screen }
  3253. var
  3254.   MaxRadius : word;
  3255.   EndAngle : word;
  3256.   ArcInfo : ArcCoordsType;
  3257. begin
  3258.   MainWindow('Arc / GetArcCoords demonstration');
  3259.   StatusLine('Esc aborts or press a key');
  3260.   MaxRadius := MaxY div 10;
  3261.   repeat
  3262.     SetColor(RandColor);
  3263.     EndAngle := Random(360);
  3264.     SetLineStyle(SolidLn, 0, NormWidth);
  3265.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  3266.     GetArcCoords(ArcInfo);
  3267.     with ArcInfo do
  3268.     begin
  3269.       Line(X, Y, XStart, YStart);
  3270.       Line(X, Y, Xend, Yend);
  3271.     end;
  3272.   until KeyPressed;
  3273.   WaitToGo;
  3274. end; { ArcPlay }
  3275.  
  3276. procedure PutPixelPlay;
  3277. { Demonstrate the PutPixel and GetPixel commands }
  3278. const
  3279.   Seed   = 1962; { A seed for the random number generator }
  3280.   NumPts = 2000; { The number of pixels plotted }
  3281.   Esc    = #27;
  3282. var
  3283.   I : word;
  3284.   X, Y, Color : word;
  3285.   XMax, YMax  : integer;
  3286.   ViewInfo    : ViewPortType;
  3287. begin
  3288.   MainWindow('PutPixel / GetPixel demonstration');
  3289.   StatusLine('Esc aborts or press a key...');
  3290.  
  3291.   GetViewSettings(ViewInfo);
  3292.   with ViewInfo do
  3293.   begin
  3294.     XMax := (x2-x1-1);
  3295.     YMax := (y2-y1-1);
  3296.   end;
  3297.  
  3298.   while not KeyPressed do
  3299.   begin
  3300.     { Plot random pixels }
  3301.     RandSeed := Seed;
  3302.     I := 0;
  3303.     while (not KeyPressed) and (I < NumPts) do
  3304.     begin
  3305.       Inc(I);
  3306.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  3307.     end;
  3308.  
  3309.     { Erase pixels }
  3310.     RandSeed := Seed;
  3311.     I := 0;
  3312.     while (not KeyPressed) and (I < NumPts) do
  3313.     begin
  3314.       Inc(I);
  3315.       X := Random(XMax)+1;
  3316.       Y := Random(YMax)+1;
  3317.       Color := GetPixel(X, Y);
  3318.         if Color = RandColor then
  3319.           PutPixel(X, Y, 0);
  3320.      end;
  3321.   end;
  3322.   WaitToGo;
  3323. end; { PutPixelPlay }
  3324.  
  3325. procedure PutImagePlay;
  3326. { Demonstrate the GetImage and PutImage commands }
  3327.  
  3328. const
  3329.   r  = 20;
  3330.   StartX = 100;
  3331.   StartY = 50;
  3332.  
  3333. var
  3334.   CurPort : ViewPortType;
  3335.  
  3336. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  3337. var
  3338.   Step : integer;
  3339. begin
  3340.   Step := Random(2*r);
  3341.   if Odd(Step) then
  3342.     Step := -Step;
  3343.   X := X + Step;
  3344.   Step := Random(r);
  3345.   if Odd(Step) then
  3346.     Step := -Step;
  3347.   Y := Y + Step;
  3348.  
  3349.   { Make saucer bounce off viewport walls }
  3350.   with CurPort do
  3351.   begin
  3352.     if (x1 + X + Width - 1 > x2) then
  3353.       X := x2-x1 - Width + 1
  3354.     else
  3355.       if (X < 0) then
  3356.         X := 0;
  3357.     if (y1 + Y + Height - 1 > y2) then
  3358.       Y := y2-y1 - Height + 1
  3359.     else
  3360.       if (Y < 0) then
  3361.         Y := 0;
  3362.   end;
  3363. end; { MoveSaucer }
  3364.  
  3365. var
  3366.   Pausetime : word;
  3367.   Saucer    : pointer;
  3368.   X, Y      : integer;
  3369.   ulx, uly  : word;
  3370.   lrx, lry  : word;
  3371.   Size      : word;
  3372.   I         : word;
  3373. begin
  3374.   ClearDevice;
  3375.   FullPort;
  3376.  
  3377.   { PaintScreen }
  3378.   ClearDevice;
  3379.   MainWindow('GetImage / PutImage Demonstration');
  3380.   StatusLine('Esc aborts or press a key...');
  3381.   GetViewSettings(CurPort);
  3382.  
  3383.   { DrawSaucer }
  3384.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  3385.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  3386.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  3387.   Circle(StartX+10, StartY-12, 2);
  3388.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  3389.   Circle(StartX-10, StartY-12, 2);
  3390.   SetFillStyle(SolidFill, MaxColor);
  3391.   FloodFill(StartX+1, StartY+4, GetColor);
  3392.  
  3393.   { ReadSaucerImage }
  3394.   ulx := StartX-(r+1);
  3395.   uly := StartY-14;
  3396.   lrx := StartX+(r+1);
  3397.   lry := StartY+(r div 3)+3;
  3398.  
  3399.   Size := ImageSize(ulx, uly, lrx, lry);
  3400.   GetMem(Saucer, Size);
  3401.   GetImage(ulx, uly, lrx, lry, Saucer^);
  3402. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  3403.  
  3404.   { Plot some "stars" }
  3405.   for I := 1 to 1000 do
  3406.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  3407.   X := MaxX div 2;
  3408.   Y := MaxY div 2;
  3409.   PauseTime := 70;
  3410.  
  3411.   { Move the saucer around }
  3412.   repeat
  3413. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  3414.      Delay(PauseTime);
  3415. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  3416.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  3417.   until KeyPressed;
  3418.   FreeMem(Saucer, size);
  3419.   WaitToGo;
  3420. end; { PutImagePlay }
  3421.  
  3422. procedure PolyPlay;
  3423. { Draw random polygons with random fill styles on the screen }
  3424. const
  3425.   MaxPts = 5;
  3426. type
  3427.   PolygonType = array[1..MaxPts] of PointType;
  3428. var
  3429.   Poly : PolygonType;
  3430.   I, Color : word;
  3431. begin
  3432.   MainWindow('FillPoly demonstration');
  3433.   StatusLine('Esc aborts or press a key...');
  3434.   repeat
  3435.     Color := RandColor;
  3436.     SetFillStyle(Random(11)+1, Color);
  3437.     SetColor(Color);
  3438.     for I := 1 to MaxPts do
  3439.       with Poly[I] do
  3440.       begin
  3441.         X := Random(MaxX);
  3442.         Y := Random(MaxY);
  3443.       end;
  3444.     FillPoly(MaxPts, Poly);
  3445.   until KeyPressed;
  3446.   WaitToGo;
  3447. end; { PolyPlay }
  3448.  
  3449. procedure FillStylePlay;
  3450. { Display all of the predefined fill styles available }
  3451. var
  3452.   Style    : word;
  3453.   Width    : word;
  3454.   Height   : word;
  3455.   X, Y     : word;
  3456.   I, J     : word;
  3457.   ViewInfo : ViewPortType;
  3458.  
  3459. procedure DrawBox(X, Y : word);
  3460. begin
  3461.   SetFillStyle(Style, MaxColor);
  3462.   with ViewInfo do
  3463.     Bar(X, Y, X+Width, Y+Height);
  3464.   Rectangle(X, Y, X+Width, Y+Height);
  3465.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  3466.   Inc(Style);
  3467. end; { DrawBox }
  3468.  
  3469. begin
  3470.   MainWindow('Pre-defined fill styles');
  3471.   GetViewSettings(ViewInfo);
  3472.   with ViewInfo do
  3473.   begin
  3474.     Width := 2 * ((x2+1) div 13);
  3475.     Height := 2 * ((y2-10) div 10);
  3476.   end;
  3477.   X := Width div 2;
  3478.   Y := Height div 2;
  3479.   Style := 0;
  3480.   for J := 1 to 3 do
  3481.   begin
  3482.     for I := 1 to 4 do
  3483.     begin
  3484.       DrawBox(X, Y);
  3485.       Inc(X, (Width div 2) * 3);
  3486.     end;
  3487.     X := Width div 2;
  3488.     Inc(Y, (Height div 2) * 3);
  3489.   end;
  3490.   SetTextJustify(LeftText, TopText);
  3491.   WaitToGo;
  3492. end; { FillStylePlay }
  3493.  
  3494. procedure FillPatternPlay;
  3495. { Display some user defined fill patterns }
  3496. const
  3497.   Patterns : array[0..11] of FillPatternType = (
  3498.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  3499.             OldColor which has a path of pixels of OldColor or NewColor
  3500.             with sides touching back to the seed point, (XSeed, YSeed).
  3501.             Therefore, only pixels of OldColor are modified and no other
  3502.             information is changed.
  3503.  
  3504.             SEE ALSO
  3505.  
  3506.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3507.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  3508.             SETVIEW
  3509.  
  3510.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  3511.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  3512.             IF WHICHVGA = 0 THEN STOP
  3513.             DUMMY=RES640
  3514.             SETVIEW 100, 100, 539, 379
  3515.             FILLVIEW 10
  3516.             WHILE INKEY$ = ""
  3517.             WEND
  3518.             VIDEOMODESET VMODE
  3519.             END
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.                                                                          63
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.           FONTGETINFO
  3544.  
  3545.             PROTOTYPE
  3546.  
  3547.             SUB FONTGETINFO (Width%, Height%)
  3548.  
  3549.             INPUT
  3550.  
  3551.             no input parameters
  3552.     WEND
  3553.             MOUSEEXIT
  3554.             VIDEOMODESET VMODE
  3555.             END
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.                                                                          86
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.           MOUSECURSORDEFAULT
  3604.  
  3605.             PROTOTYPE
  3606.  
  3607.             SUB MOUSECURSORDEFAULT ()
  3608.  
  3609.             INPUT
  3610.  
  3611.             no input parameters
  3612.  
  3613.             OUTPUT
  3614.  
  3615.             no value returned
  3616.  
  3617.             USAGE
  3618.  
  3619.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  3620.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  3621. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  3622. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  3623. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  3624. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  3625. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  3626. $╤
  3627. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  3628. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  3629. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  3630. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  3631. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  3632. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  3633. ░£▒
  3634. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  3635. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  3636.       end;
  3637.     end;
  3638.   end;
  3639.   WaitToGo;
  3640. end; { UserLineStylePlay }
  3641.  
  3642.  
  3643. procedure SayGoodbye;
  3644. { Say goodbye and then exit the program }
  3645. var
  3646.   ViewInfo : ViewPortType;
  3647. begin
  3648.   MainWindow('');
  3649.   GetViewSettings(ViewInfo);
  3650.   SetTextStyle(TriplexFont, HorizDir, 4);
  3651.   SetTextJustify(CenterText, CenterText);
  3652.   with ViewInfo do
  3653.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  3654.   StatusLine('Press any key to quit...');
  3655.   repeat until KeyPressed;
  3656. end; { SayGoodbye }
  3657.  
  3658.  
  3659. PROCEDURE SelectMode;
  3660. VAR
  3661.     choice1,choice2     : CHAR;
  3662.    xsize,ysize            : WORD;
  3663. BEGIN
  3664.     (* Let's select a mode *)
  3665.     ClrScr;
  3666.     WriteLn('VESADEMO:');
  3667.     WriteLn('1. 256 colors');
  3668.     WriteLn('2. 32768 colors');
  3669.     WriteLn('3. 65536 colors');
  3670.     WriteLn('4. 16777216 colors');
  3671.     WriteLn('Q uit');
  3672.     WriteLn;
  3673.     Write('Your choice: ');
  3674.     REPEAT
  3675.         ReadLn(choice1);
  3676.       IF choice1 <> '1' THEN BEGIN
  3677.           WriteLn('Sorry !');
  3678.          WriteLn('This demo wasn''t written for more as 256 colors !');
  3679.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  3680.          WriteLn('Switching to 256 colors.');
  3681.          choice1 := '1';
  3682.       END;
  3683.     UNTIL choice1 IN ['1'..'4','q'];
  3684.     IF choice1 = 'q' THEN Halt;
  3685.  
  3686.     WriteLn;
  3687.     WriteLn;
  3688.     WriteLn('a. 320x200');
  3689.     WriteLn('b. 640x480');
  3690.     WriteLn('c. 800x600');
  3691.     WriteLn('d. 1024x768');
  3692.     WriteLn('e. 1280x1024');
  3693.     WriteLn('Q uit');
  3694.     WriteLn;
  3695.     Write('Your choice: ');
  3696.     REPEAT
  3697.         ReadLn(choice2);
  3698.     UNTIL choice2 IN ['a'..'e','q'];
  3699.     IF choice2 = 'q' THEN Halt;
  3700.  
  3701.     CASE choice2 OF
  3702.         'a' : BEGIN
  3703.             xsize := 320;
  3704.             ysize := 200;
  3705.         END;
  3706.         'b' : BEGIN
  3707.             xsize := 640;
  3708.             ysize := 480;
  3709.         END;
  3710.         'c' : BEGIN
  3711.             xsize := 800;
  3712.             ysize := 600;
  3713.         END;
  3714.         'd' : BEGIN
  3715.             xsize := 1024;
  3716.             ysize := 768;
  3717.         END;
  3718.         'e' : BEGIN
  3719.             xsize := 1280;
  3720.             ysize := 1024;
  3721.         END;
  3722.     END;
  3723.     CASE choice1 OF
  3724.         '1' : mode := FindVesaMode(xsize,ysize,8);
  3725.         '2' : mode := FindVesaMode(xsize,ysize,15);
  3726.         '3' : mode := FindVesaMode(xsize,ysize,16);
  3727.         '4' : mode := FindVesaMode(xsize,ysize,24);
  3728.     END;
  3729.     IF mode = 0 THEN BEGIN
  3730.         WriteLn('No such mode could be found !');
  3731.         WriteLn('Switching to to 320x200.');
  3732.         ReadKey;
  3733.         mode := V320x200x256;
  3734.     END;
  3735. END;
  3736.  
  3737. begin { program body }
  3738.   SelectMode;
  3739.   Initialize;
  3740.   ReportStatus;
  3741.  
  3742. {  AspectRatioPlay; }
  3743.   FillEllipsePlay;
  3744.   SectorPlay;
  3745.   WriteModePlay;
  3746.  
  3747.   ColorPlay;
  3748.   { PalettePlay only intended to work on these drivers: }
  3749.   if (GraphDriver = EGA) or
  3750.       (GraphDriver = EGA64) or
  3751.       (GraphDriver = VGA) then
  3752.      PalettePlay;
  3753.   PutPixelPlay;
  3754. {  PutImagePlay; }
  3755.   RandBarPlay;
  3756.   BarPlay;
  3757.   Bar3DPlay;
  3758.   ArcPlay;
  3759.   CirclePlay;
  3760.   PiePlay;
  3761.   LineToPlay;
  3762.   LineRelPlay;
  3763. {  LineStylePlay; }
  3764. {  UserLineStylePlay; }
  3765.   TextDump;
  3766.   TextPlay;
  3767.   CrtModePlay;
  3768.   FillStylePlay;
  3769.   FillPatternPlay;
  3770.   PolyPlay;
  3771.   SayGoodbye;
  3772. {  CloseGraph; }
  3773.   CloseVesa;
  3774. end.
  3775. ***************************************************
  3776.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  3777.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  3778. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  3779. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  3780. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  3781. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  3782.     Color := RandColor;
  3783.     SetColor(Color);
  3784.     SetFillStyle(Random(CloseDotFill)+1, Color);
  3785.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  3786.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  3787.   until KeyPressed;
  3788.   WaitToGo;
  3789. end; { RandBarPlay }
  3790.  
  3791. procedure ArcPlay;
  3792. { Draw random arcs on the screen }
  3793. var
  3794.   MaxRadius : word;
  3795.   EndAngle : word;
  3796.   ArcInfo : ArcCoordsType;
  3797. begin
  3798.   MainWindow('Arc / GetArcCoords demonstration');
  3799.   StatusLine('Esc aborts or press a key');
  3800.   MaxRadius := MaxY div 10;
  3801.   repeat
  3802.     SetColor(RandColor);
  3803.     EndAngle := Random(360);
  3804.     SetLineStyle(SolidLn, 0, NormWidth);
  3805.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  3806.     GetArcCoords(ArcInfo);
  3807.     with ArcInfo do
  3808.     begin
  3809.       Line(X, Y, XStart, YStart);
  3810.       Line(X, Y, Xend, Yend);
  3811.     end;
  3812.   until KeyPressed;
  3813.   WaitToGo;
  3814. end; { ArcPlay }
  3815.  
  3816. procedure PutPixelPlay;
  3817. { Demonstrate the PutPixel and GetPixel commands }
  3818. const
  3819.   Seed   = 1962; { A seed for the random number generator }
  3820.   NumPts = 2000; { The number of pixels plotted }
  3821.   Esc    = #27;
  3822. var
  3823.   I : word;
  3824.   X, Y, Color : word;
  3825.   XMax, YMax  : integer;
  3826.   ViewInfo    : ViewPortType;
  3827. begin
  3828.   MainWindow('PutPixel / GetPixel demonstration');
  3829.   StatusLine('Esc aborts or press a key...');
  3830.  
  3831.   GetViewSettings(ViewInfo);
  3832.   with ViewInfo do
  3833.   begin
  3834.     XMax := (x2-x1-1);
  3835.     YMax := (y2-y1-1);
  3836.   end;
  3837.  
  3838.   while not KeyPressed do
  3839.   begin
  3840.     { Plot random pixels }
  3841.     RandSeed := Seed;
  3842.     I := 0;
  3843.     while (not KeyPressed) and (I < NumPts) do
  3844.     begin
  3845.       Inc(I);
  3846.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  3847.     end;
  3848.  
  3849.     { Erase pixels }
  3850.     RandSeed := Seed;
  3851.     I := 0;
  3852.     while (not KeyPressed) and (I < NumPts) do
  3853.     begin
  3854.       Inc(I);
  3855.       X := Random(XMax)+1;
  3856.       Y := Random(YMax)+1;
  3857.       Color := GetPixel(X, Y);
  3858.         if Color = RandColor then
  3859.           PutPixel(X, Y, 0);
  3860.      end;
  3861.   end;
  3862.   WaitToGo;
  3863. end; { PutPixelPlay }
  3864.  
  3865. procedure PutImagePlay;
  3866. { Demonstrate the GetImage and PutImage commands }
  3867.  
  3868. const
  3869.   r  = 20;
  3870.   StartX = 100;
  3871.   StartY = 50;
  3872.  
  3873. var
  3874.   CurPort : ViewPortType;
  3875.  
  3876. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  3877. var
  3878.   Step : integer;
  3879. begin
  3880.   Step := Random(2*r);
  3881.   if Odd(Step) then
  3882.     Step := -Step;
  3883.   X := X + Step;
  3884.   Step := Random(r);
  3885.   if Odd(Step) then
  3886.     Step := -Step;
  3887.   Y := Y + Step;
  3888.  
  3889.   { Make saucer bounce off viewport walls }
  3890.   with CurPort do
  3891.   begin
  3892.     if (x1 + X + Width - 1 > x2) then
  3893.       X := x2-x1 - Width + 1
  3894.     else
  3895.       if (X < 0) then
  3896.         X := 0;
  3897.     if (y1 + Y + Height - 1 > y2) then
  3898.       Y := y2-y1 - Height + 1
  3899.     else
  3900.       if (Y < 0) then
  3901.         Y := 0;
  3902.   end;
  3903. end; { MoveSaucer }
  3904.  
  3905. var
  3906.   Pausetime : word;
  3907.   Saucer    : pointer;
  3908.   X, Y      : integer;
  3909.   ulx, uly  : word;
  3910.   lrx, lry  : word;
  3911.   Size      : word;
  3912.   I         : word;
  3913. begin
  3914.   ClearDevice;
  3915.   FullPort;
  3916.  
  3917.   { PaintScreen }
  3918.   ClearDevice;
  3919.   MainWindow('GetImage / PutImage Demonstration');
  3920.   StatusLine('Esc aborts or press a key...');
  3921.   GetViewSettings(CurPort);
  3922.  
  3923.   { DrawSaucer }
  3924.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  3925.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  3926.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  3927.   Circle(StartX+10, StartY-12, 2);
  3928.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  3929.   Circle(StartX-10, StartY-12, 2);
  3930.   SetFillStyle(SolidFill, MaxColor);
  3931.   FloodFill(StartX+1, StartY+4, GetColor);
  3932.  
  3933.   { ReadSaucerImage }
  3934.   ulx := StartX-(r+1);
  3935.   uly := StartY-14;
  3936.   lrx := StartX+(r+1);
  3937.   lry := StartY+(r div 3)+3;
  3938.  
  3939.   Size := ImageSize(ulx, uly, lrx, lry);
  3940.   GetMem(Saucer, Size);
  3941.   GetImage(ulx, uly, lrx, lry, Saucer^);
  3942. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  3943.  
  3944.   { Plot some "stars" }
  3945.   for I := 1 to 1000 do
  3946.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  3947.   X := MaxX div 2;
  3948.   Y := MaxY div 2;
  3949.   PauseTime := 70;
  3950.  
  3951.   { Move the saucer around }
  3952.   repeat
  3953. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  3954.      Delay(PauseTime);
  3955. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  3956.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  3957.   until KeyPressed;
  3958.   FreeMem(Saucer, size);
  3959.   WaitToGo;
  3960. end; { PutImagePlay }
  3961.  
  3962. procedure PolyPlay;
  3963. { Draw random polygons with random fill styles on the screen }
  3964. const
  3965.   MaxPts = 5;
  3966. type
  3967.   PolygonType = array[1..MaxPts] of PointType;
  3968. var
  3969.   Poly : PolygonType;
  3970.   I, Color : word;
  3971. begin
  3972.   MainWindow('FillPoly demonstration');
  3973.   StatusLine('Esc aborts or press a key...');
  3974.   repeat
  3975.     Color := RandColor;
  3976.     SetFillStyle(Random(11)+1, Color);
  3977.     SetColor(Color);
  3978.     for I := 1 to MaxPts do
  3979.       with Poly[I] do
  3980.       begin
  3981.         X := Random(MaxX);
  3982.         Y := Random(MaxY);
  3983.       end;
  3984.     FillPoly(MaxPts, Poly);
  3985.   until KeyPressed;
  3986.   WaitToGo;
  3987. end; { PolyPlay }
  3988.  
  3989. procedure FillStylePlay;
  3990. { Display all of the predefined fill styles available }
  3991. var
  3992.   Style    : word;
  3993.   Width    : word;
  3994.   Height   : word;
  3995.   X, Y     : word;
  3996.   I, J     : word;
  3997.   ViewInfo : ViewPortType;
  3998.  
  3999. procedure DrawBox(X, Y : word);
  4000. begin
  4001.   SetFillStyle(Style, MaxColor);
  4002.   with ViewInfo do
  4003.     Bar(X, Y, X+Width, Y+Height);
  4004.   Rectangle(X, Y, X+Width, Y+Height);
  4005.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  4006.   Inc(Style);
  4007. end; { DrawBox }
  4008.  
  4009. begin
  4010.   MainWindow('Pre-defined fill styles');
  4011.   GetViewSettings(ViewInfo);
  4012.   with ViewInfo do
  4013.   begin
  4014.     Width := 2 * ((x2+1) div 13);
  4015.     Height := 2 * ((y2-10) div 10);
  4016.   end;
  4017.   X := Width div 2;
  4018.   Y := Height div 2;
  4019.   Style := 0;
  4020.   for J := 1 to 3 do
  4021.   begin
  4022.     for I := 1 to 4 do
  4023.     begin
  4024.       DrawBox(X, Y);
  4025.       Inc(X, (Width div 2) * 3);
  4026.     end;
  4027.     X := Width div 2;
  4028.     Inc(Y, (Height div 2) * 3);
  4029.   end;
  4030.   SetTextJustify(LeftText, TopText);
  4031.   WaitToGo;
  4032. end; { FillStylePlay }
  4033.  
  4034. procedure FillPatternPlay;
  4035. { Display some user defined fill patterns }
  4036. const
  4037.   Patterns : array[0..11] of FillPatternType = (
  4038.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  4039.             OldColor which has a path of pixels of OldColor or NewColor
  4040.             with sides touching back to the seed point, (XSeed, YSeed).
  4041.             Therefore, only pixels of OldColor are modified and no other
  4042.             information is changed.
  4043.  
  4044.             SEE ALSO
  4045.  
  4046.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4047.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  4048.             SETVIEW
  4049.  
  4050.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  4051.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  4052.             IF WHICHVGA = 0 THEN STOP
  4053.             DUMMY=RES640
  4054.             SETVIEW 100, 100, 539, 379
  4055.             FILLVIEW 10
  4056.             WHILE INKEY$ = ""
  4057.             WEND
  4058.             VIDEOMODESET VMODE
  4059.             END
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.                                                                          63
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.           FONTGETINFO
  4084.  
  4085.             PROTOTYPE
  4086.  
  4087.             SUB FONTGETINFO (Width%, Height%)
  4088.  
  4089.             INPUT
  4090.  
  4091.             no input parameters
  4092.     WEND
  4093.             MOUSEEXIT
  4094.             VIDEOMODESET VMODE
  4095.             END
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.  
  4133.  
  4134.  
  4135.  
  4136.                                                                          86
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.           MOUSECURSORDEFAULT
  4144.  
  4145.             PROTOTYPE
  4146.  
  4147.             SUB MOUSECURSORDEFAULT ()
  4148.  
  4149.             INPUT
  4150.  
  4151.             no input parameters
  4152.  
  4153.             OUTPUT
  4154.  
  4155.             no value returned
  4156.  
  4157.             USAGE
  4158.  
  4159.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  4160.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  4161. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  4162. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  4163. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  4164. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  4165. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  4166. $╤
  4167. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  4168. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  4169. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  4170. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  4171. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  4172. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  4173. ░£▒
  4174. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  4175. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  4176.       end;
  4177.     end;
  4178.   end;
  4179.   WaitToGo;
  4180. end; { UserLineStylePlay }
  4181.  
  4182.  
  4183. procedure SayGoodbye;
  4184. { Say goodbye and then exit the program }
  4185. var
  4186.   ViewInfo : ViewPortType;
  4187. begin
  4188.   MainWindow('');
  4189.   GetViewSettings(ViewInfo);
  4190.   SetTextStyle(TriplexFont, HorizDir, 4);
  4191.   SetTextJustify(CenterText, CenterText);
  4192.   with ViewInfo do
  4193.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  4194.   StatusLine('Press any key to quit...');
  4195.   repeat until KeyPressed;
  4196. end; { SayGoodbye }
  4197.  
  4198.  
  4199. PROCEDURE SelectMode;
  4200. VAR
  4201.     choice1,choice2     : CHAR;
  4202.    xsize,ysize            : WORD;
  4203. BEGIN
  4204.     (* Let's select a mode *)
  4205.     ClrScr;
  4206.     WriteLn('VESADEMO:');
  4207.     WriteLn('1. 256 colors');
  4208.     WriteLn('2. 32768 colors');
  4209.     WriteLn('3. 65536 colors');
  4210.     WriteLn('4. 16777216 colors');
  4211.     WriteLn('Q uit');
  4212.     WriteLn;
  4213.     Write('Your choice: ');
  4214.     REPEAT
  4215.         ReadLn(choice1);
  4216.       IF choice1 <> '1' THEN BEGIN
  4217.           WriteLn('Sorry !');
  4218.          WriteLn('This demo wasn''t written for more as 256 colors !');
  4219.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  4220.          WriteLn('Switching to 256 colors.');
  4221.          choice1 := '1';
  4222.       END;
  4223.     UNTIL choice1 IN ['1'..'4','q'];
  4224.     IF choice1 = 'q' THEN Halt;
  4225.  
  4226.     WriteLn;
  4227.     WriteLn;
  4228.     WriteLn('a. 320x200');
  4229.     WriteLn('b. 640x480');
  4230.     WriteLn('c. 800x600');
  4231.     WriteLn('d. 1024x768');
  4232.     WriteLn('e. 1280x1024');
  4233.     WriteLn('Q uit');
  4234.     WriteLn;
  4235.     Write('Your choice: ');
  4236.     REPEAT
  4237.         ReadLn(choice2);
  4238.     UNTIL choice2 IN ['a'..'e','q'];
  4239.     IF choice2 = 'q' THEN Halt;
  4240.  
  4241.     CASE choice2 OF
  4242.         'a' : BEGIN
  4243.             xsize := 320;
  4244.             ysize := 200;
  4245.         END;
  4246.         'b' : BEGIN
  4247.             xsize := 640;
  4248.             ysize := 480;
  4249.         END;
  4250.         'c' : BEGIN
  4251.             xsize := 800;
  4252.             ysize := 600;
  4253.         END;
  4254.         'd' : BEGIN
  4255.             xsize := 1024;
  4256.             ysize := 768;
  4257.         END;
  4258.         'e' : BEGIN
  4259.             xsize := 1280;
  4260.             ysize := 1024;
  4261.         END;
  4262.     END;
  4263.     CASE choice1 OF
  4264.         '1' : mode := FindVesaMode(xsize,ysize,8);
  4265.         '2' : mode := FindVesaMode(xsize,ysize,15);
  4266.         '3' : mode := FindVesaMode(xsize,ysize,16);
  4267.         '4' : mode := FindVesaMode(xsize,ysize,24);
  4268.     END;
  4269.     IF mode = 0 THEN BEGIN
  4270.         WriteLn('No such mode could be found !');
  4271.         WriteLn('Switching to to 320x200.');
  4272.         ReadKey;
  4273.         mode := V320x200x256;
  4274.     END;
  4275. END;
  4276.  
  4277. begin { program body }
  4278.   SelectMode;
  4279.   Initialize;
  4280.   ReportStatus;
  4281.  
  4282. {  AspectRatioPlay; }
  4283.   FillEllipsePlay;
  4284.   SectorPlay;
  4285.   WriteModePlay;
  4286.  
  4287.   ColorPlay;
  4288.   { PalettePlay only intended to work on these drivers: }
  4289.   if (GraphDriver = EGA) or
  4290.       (GraphDriver = EGA64) or
  4291.       (GraphDriver = VGA) then
  4292.      PalettePlay;
  4293.   PutPixelPlay;
  4294. {  PutImagePlay; }
  4295.   RandBarPlay;
  4296.   BarPlay;
  4297.   Bar3DPlay;
  4298.   ArcPlay;
  4299.   CirclePlay;
  4300.   PiePlay;
  4301.   LineToPlay;
  4302.   LineRelPlay;
  4303. {  LineStylePlay; }
  4304. {  UserLineStylePlay; }
  4305.   TextDump;
  4306.   TextPlay;
  4307.   CrtModePlay;
  4308.   FillStylePlay;
  4309.   FillPatternPlay;
  4310.   PolyPlay;
  4311.   SayGoodbye;
  4312. {  CloseGraph; }
  4313.   CloseVesa;
  4314. end.
  4315. ***************************************************
  4316.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  4317.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  4318. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  4319. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  4320. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  4321. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  4322.     Color := RandColor;
  4323.     SetColor(Color);
  4324.     SetFillStyle(Random(CloseDotFill)+1, Color);
  4325.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  4326.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  4327.   until KeyPressed;
  4328.   WaitToGo;
  4329. end; { RandBarPlay }
  4330.  
  4331. procedure ArcPlay;
  4332. { Draw random arcs on the screen }
  4333. var
  4334.   MaxRadius : word;
  4335.   EndAngle : word;
  4336.   ArcInfo : ArcCoordsType;
  4337. begin
  4338.   MainWindow('Arc / GetArcCoords demonstration');
  4339.   StatusLine('Esc aborts or press a key');
  4340.   MaxRadius := MaxY div 10;
  4341.   repeat
  4342.     SetColor(RandColor);
  4343.     EndAngle := Random(360);
  4344.     SetLineStyle(SolidLn, 0, NormWidth);
  4345.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  4346.     GetArcCoords(ArcInfo);
  4347.     with ArcInfo do
  4348.     begin
  4349.       Line(X, Y, XStart, YStart);
  4350.       Line(X, Y, Xend, Yend);
  4351.     end;
  4352.   until KeyPressed;
  4353.   WaitToGo;
  4354. end; { ArcPlay }
  4355.  
  4356. procedure PutPixelPlay;
  4357. { Demonstrate the PutPixel and GetPixel commands }
  4358. const
  4359.   Seed   = 1962; { A seed for the random number generator }
  4360.   NumPts = 2000; { The number of pixels plotted }
  4361.   Esc    = #27;
  4362. var
  4363.   I : word;
  4364.   X, Y, Color : word;
  4365.   XMax, YMax  : integer;
  4366.   ViewInfo    : ViewPortType;
  4367. begin
  4368.   MainWindow('PutPixel / GetPixel demonstration');
  4369.   StatusLine('Esc aborts or press a key...');
  4370.  
  4371.   GetViewSettings(ViewInfo);
  4372.   with ViewInfo do
  4373.   begin
  4374.     XMax := (x2-x1-1);
  4375.     YMax := (y2-y1-1);
  4376.   end;
  4377.  
  4378.   while not KeyPressed do
  4379.   begin
  4380.     { Plot random pixels }
  4381.     RandSeed := Seed;
  4382.     I := 0;
  4383.     while (not KeyPressed) and (I < NumPts) do
  4384.     begin
  4385.       Inc(I);
  4386.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  4387.     end;
  4388.  
  4389.     { Erase pixels }
  4390.     RandSeed := Seed;
  4391.     I := 0;
  4392.     while (not KeyPressed) and (I < NumPts) do
  4393.     begin
  4394.       Inc(I);
  4395.       X := Random(XMax)+1;
  4396.       Y := Random(YMax)+1;
  4397.       Color := GetPixel(X, Y);
  4398.         if Color = RandColor then
  4399.           PutPixel(X, Y, 0);
  4400.      end;
  4401.   end;
  4402.   WaitToGo;
  4403. end; { PutPixelPlay }
  4404.  
  4405. procedure PutImagePlay;
  4406. { Demonstrate the GetImage and PutImage commands }
  4407.  
  4408. const
  4409.   r  = 20;
  4410.   StartX = 100;
  4411.   StartY = 50;
  4412.  
  4413. var
  4414.   CurPort : ViewPortType;
  4415.  
  4416. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  4417. var
  4418.   Step : integer;
  4419. begin
  4420.   Step := Random(2*r);
  4421.   if Odd(Step) then
  4422.     Step := -Step;
  4423.   X := X + Step;
  4424.   Step := Random(r);
  4425.   if Odd(Step) then
  4426.     Step := -Step;
  4427.   Y := Y + Step;
  4428.  
  4429.   { Make saucer bounce off viewport walls }
  4430.   with CurPort do
  4431.   begin
  4432.     if (x1 + X + Width - 1 > x2) then
  4433.       X := x2-x1 - Width + 1
  4434.     else
  4435.       if (X < 0) then
  4436.         X := 0;
  4437.     if (y1 + Y + Height - 1 > y2) then
  4438.       Y := y2-y1 - Height + 1
  4439.     else
  4440.       if (Y < 0) then
  4441.         Y := 0;
  4442.   end;
  4443. end; { MoveSaucer }
  4444.  
  4445. var
  4446.   Pausetime : word;
  4447.   Saucer    : pointer;
  4448.   X, Y      : integer;
  4449.   ulx, uly  : word;
  4450.   lrx, lry  : word;
  4451.   Size      : word;
  4452.   I         : word;
  4453. begin
  4454.   ClearDevice;
  4455.   FullPort;
  4456.  
  4457.   { PaintScreen }
  4458.   ClearDevice;
  4459.   MainWindow('GetImage / PutImage Demonstration');
  4460.   StatusLine('Esc aborts or press a key...');
  4461.   GetViewSettings(CurPort);
  4462.  
  4463.   { DrawSaucer }
  4464.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  4465.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  4466.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  4467.   Circle(StartX+10, StartY-12, 2);
  4468.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  4469.   Circle(StartX-10, StartY-12, 2);
  4470.   SetFillStyle(SolidFill, MaxColor);
  4471.   FloodFill(StartX+1, StartY+4, GetColor);
  4472.  
  4473.   { ReadSaucerImage }
  4474.   ulx := StartX-(r+1);
  4475.   uly := StartY-14;
  4476.   lrx := StartX+(r+1);
  4477.   lry := StartY+(r div 3)+3;
  4478.  
  4479.   Size := ImageSize(ulx, uly, lrx, lry);
  4480.   GetMem(Saucer, Size);
  4481.   GetImage(ulx, uly, lrx, lry, Saucer^);
  4482. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  4483.  
  4484.   { Plot some "stars" }
  4485.   for I := 1 to 1000 do
  4486.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  4487.   X := MaxX div 2;
  4488.   Y := MaxY div 2;
  4489.   PauseTime := 70;
  4490.  
  4491.   { Move the saucer around }
  4492.   repeat
  4493. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  4494.      Delay(PauseTime);
  4495. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  4496.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  4497.   until KeyPressed;
  4498.   FreeMem(Saucer, size);
  4499.   WaitToGo;
  4500. end; { PutImagePlay }
  4501.  
  4502. procedure PolyPlay;
  4503. { Draw random polygons with random fill styles on the screen }
  4504. const
  4505.   MaxPts = 5;
  4506. type
  4507.   PolygonType = array[1..MaxPts] of PointType;
  4508. var
  4509.   Poly : PolygonType;
  4510.   I, Color : word;
  4511. begin
  4512.   MainWindow('FillPoly demonstration');
  4513.   StatusLine('Esc aborts or press a key...');
  4514.   repeat
  4515.     Color := RandColor;
  4516.     SetFillStyle(Random(11)+1, Color);
  4517.     SetColor(Color);
  4518.     for I := 1 to MaxPts do
  4519.       with Poly[I] do
  4520.       begin
  4521.         X := Random(MaxX);
  4522.         Y := Random(MaxY);
  4523.       end;
  4524.     FillPoly(MaxPts, Poly);
  4525.   until KeyPressed;
  4526.   WaitToGo;
  4527. end; { PolyPlay }
  4528.  
  4529. procedure FillStylePlay;
  4530. { Display all of the predefined fill styles available }
  4531. var
  4532.   Style    : word;
  4533.   Width    : word;
  4534.   Height   : word;
  4535.   X, Y     : word;
  4536.   I, J     : word;
  4537.   ViewInfo : ViewPortType;
  4538.  
  4539. procedure DrawBox(X, Y : word);
  4540. begin
  4541.   SetFillStyle(Style, MaxColor);
  4542.   with ViewInfo do
  4543.     Bar(X, Y, X+Width, Y+Height);
  4544.   Rectangle(X, Y, X+Width, Y+Height);
  4545.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  4546.   Inc(Style);
  4547. end; { DrawBox }
  4548.  
  4549. begin
  4550.   MainWindow('Pre-defined fill styles');
  4551.   GetViewSettings(ViewInfo);
  4552.   with ViewInfo do
  4553.   begin
  4554.     Width := 2 * ((x2+1) div 13);
  4555.     Height := 2 * ((y2-10) div 10);
  4556.   end;
  4557.   X := Width div 2;
  4558.   Y := Height div 2;
  4559.   Style := 0;
  4560.   for J := 1 to 3 do
  4561.   begin
  4562.     for I := 1 to 4 do
  4563.     begin
  4564.       DrawBox(X, Y);
  4565.       Inc(X, (Width div 2) * 3);
  4566.     end;
  4567.     X := Width div 2;
  4568.     Inc(Y, (Height div 2) * 3);
  4569.   end;
  4570.   SetTextJustify(LeftText, TopText);
  4571.   WaitToGo;
  4572. end; { FillStylePlay }
  4573.  
  4574. procedure FillPatternPlay;
  4575. { Display some user defined fill patterns }
  4576. const
  4577.   Patterns : array[0..11] of FillPatternType = (
  4578.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  4579.             OldColor which has a path of pixels of OldColor or NewColor
  4580.             with sides touching back to the seed point, (XSeed, YSeed).
  4581.             Therefore, only pixels of OldColor are modified and no other
  4582.             information is changed.
  4583.  
  4584.             SEE ALSO
  4585.  
  4586.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4587.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  4588.             SETVIEW
  4589.  
  4590.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  4591.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  4592.             IF WHICHVGA = 0 THEN STOP
  4593.             DUMMY=RES640
  4594.             SETVIEW 100, 100, 539, 379
  4595.             FILLVIEW 10
  4596.             WHILE INKEY$ = ""
  4597.             WEND
  4598.             VIDEOMODESET VMODE
  4599.             END
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.                                                                          63
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.           FONTGETINFO
  4624.  
  4625.             PROTOTYPE
  4626.  
  4627.             SUB FONTGETINFO (Width%, Height%)
  4628.  
  4629.             INPUT
  4630.  
  4631.             no input parameters
  4632.     WEND
  4633.             MOUSEEXIT
  4634.             VIDEOMODESET VMODE
  4635.             END
  4636.  
  4637.  
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.                                                                          86
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.           MOUSECURSORDEFAULT
  4684.  
  4685.             PROTOTYPE
  4686.  
  4687.             SUB MOUSECURSORDEFAULT ()
  4688.  
  4689.             INPUT
  4690.  
  4691.             no input parameters
  4692.  
  4693.             OUTPUT
  4694.  
  4695.             no value returned
  4696.  
  4697.             USAGE
  4698.  
  4699.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  4700.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  4701. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  4702. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  4703. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  4704. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  4705. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  4706. $╤
  4707. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  4708. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  4709. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  4710. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  4711. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  4712. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  4713. ░£▒
  4714. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  4715. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  4716.       end;
  4717.     end;
  4718.   end;
  4719.   WaitToGo;
  4720. end; { UserLineStylePlay }
  4721.  
  4722.  
  4723. procedure SayGoodbye;
  4724. { Say goodbye and then exit the program }
  4725. var
  4726.   ViewInfo : ViewPortType;
  4727. begin
  4728.   MainWindow('');
  4729.   GetViewSettings(ViewInfo);
  4730.   SetTextStyle(TriplexFont, HorizDir, 4);
  4731.   SetTextJustify(CenterText, CenterText);
  4732.   with ViewInfo do
  4733.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  4734.   StatusLine('Press any key to quit...');
  4735.   repeat until KeyPressed;
  4736. end; { SayGoodbye }
  4737.  
  4738.  
  4739. PROCEDURE SelectMode;
  4740. VAR
  4741.     choice1,choice2     : CHAR;
  4742.    xsize,ysize            : WORD;
  4743. BEGIN
  4744.     (* Let's select a mode *)
  4745.     ClrScr;
  4746.     WriteLn('VESADEMO:');
  4747.     WriteLn('1. 256 colors');
  4748.     WriteLn('2. 32768 colors');
  4749.     WriteLn('3. 65536 colors');
  4750.     WriteLn('4. 16777216 colors');
  4751.     WriteLn('Q uit');
  4752.     WriteLn;
  4753.     Write('Your choice: ');
  4754.     REPEAT
  4755.         ReadLn(choice1);
  4756.       IF choice1 <> '1' THEN BEGIN
  4757.           WriteLn('Sorry !');
  4758.          WriteLn('This demo wasn''t written for more as 256 colors !');
  4759.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  4760.          WriteLn('Switching to 256 colors.');
  4761.          choice1 := '1';
  4762.       END;
  4763.     UNTIL choice1 IN ['1'..'4','q'];
  4764.     IF choice1 = 'q' THEN Halt;
  4765.  
  4766.     WriteLn;
  4767.     WriteLn;
  4768.     WriteLn('a. 320x200');
  4769.     WriteLn('b. 640x480');
  4770.     WriteLn('c. 800x600');
  4771.     WriteLn('d. 1024x768');
  4772.     WriteLn('e. 1280x1024');
  4773.     WriteLn('Q uit');
  4774.     WriteLn;
  4775.     Write('Your choice: ');
  4776.     REPEAT
  4777.         ReadLn(choice2);
  4778.     UNTIL choice2 IN ['a'..'e','q'];
  4779.     IF choice2 = 'q' THEN Halt;
  4780.  
  4781.     CASE choice2 OF
  4782.         'a' : BEGIN
  4783.             xsize := 320;
  4784.             ysize := 200;
  4785.         END;
  4786.         'b' : BEGIN
  4787.             xsize := 640;
  4788.             ysize := 480;
  4789.         END;
  4790.         'c' : BEGIN
  4791.             xsize := 800;
  4792.             ysize := 600;
  4793.         END;
  4794.         'd' : BEGIN
  4795.             xsize := 1024;
  4796.             ysize := 768;
  4797.         END;
  4798.         'e' : BEGIN
  4799.             xsize := 1280;
  4800.             ysize := 1024;
  4801.         END;
  4802.     END;
  4803.     CASE choice1 OF
  4804.         '1' : mode := FindVesaMode(xsize,ysize,8);
  4805.         '2' : mode := FindVesaMode(xsize,ysize,15);
  4806.         '3' : mode := FindVesaMode(xsize,ysize,16);
  4807.         '4' : mode := FindVesaMode(xsize,ysize,24);
  4808.     END;
  4809.     IF mode = 0 THEN BEGIN
  4810.         WriteLn('No such mode could be found !');
  4811.         WriteLn('Switching to to 320x200.');
  4812.         ReadKey;
  4813.         mode := V320x200x256;
  4814.     END;
  4815. END;
  4816.  
  4817. begin { program body }
  4818.   SelectMode;
  4819.   Initialize;
  4820.   ReportStatus;
  4821.  
  4822. {  AspectRatioPlay; }
  4823.   FillEllipsePlay;
  4824.   SectorPlay;
  4825.   WriteModePlay;
  4826.  
  4827.   ColorPlay;
  4828.   { PalettePlay only intended to work on these drivers: }
  4829.   if (GraphDriver = EGA) or
  4830.       (GraphDriver = EGA64) or
  4831.       (GraphDriver = VGA) then
  4832.      PalettePlay;
  4833.   PutPixelPlay;
  4834. {  PutImagePlay; }
  4835.   RandBarPlay;
  4836.   BarPlay;
  4837.   Bar3DPlay;
  4838.   ArcPlay;
  4839.   CirclePlay;
  4840.   PiePlay;
  4841.   LineToPlay;
  4842.   LineRelPlay;
  4843. {  LineStylePlay; }
  4844. {  UserLineStylePlay; }
  4845.   TextDump;
  4846.   TextPlay;
  4847.   CrtModePlay;
  4848.   FillStylePlay;
  4849.   FillPatternPlay;
  4850.   PolyPlay;
  4851.   SayGoodbye;
  4852. {  CloseGraph; }
  4853.   CloseVesa;
  4854. end.
  4855. ***************************************************
  4856.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  4857.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  4858. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  4859. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  4860. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  4861. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  4862.     Color := RandColor;
  4863.     SetColor(Color);
  4864.     SetFillStyle(Random(CloseDotFill)+1, Color);
  4865.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  4866.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  4867.   until KeyPressed;
  4868.   WaitToGo;
  4869. end; { RandBarPlay }
  4870.  
  4871. procedure ArcPlay;
  4872. { Draw random arcs on the screen }
  4873. var
  4874.   MaxRadius : word;
  4875.   EndAngle : word;
  4876.   ArcInfo : ArcCoordsType;
  4877. begin
  4878.   MainWindow('Arc / GetArcCoords demonstration');
  4879.   StatusLine('Esc aborts or press a key');
  4880.   MaxRadius := MaxY div 10;
  4881.   repeat
  4882.     SetColor(RandColor);
  4883.     EndAngle := Random(360);
  4884.     SetLineStyle(SolidLn, 0, NormWidth);
  4885.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  4886.     GetArcCoords(ArcInfo);
  4887.     with ArcInfo do
  4888.     begin
  4889.       Line(X, Y, XStart, YStart);
  4890.       Line(X, Y, Xend, Yend);
  4891.     end;
  4892.   until KeyPressed;
  4893.   WaitToGo;
  4894. end; { ArcPlay }
  4895.  
  4896. procedure PutPixelPlay;
  4897. { Demonstrate the PutPixel and GetPixel commands }
  4898. const
  4899.   Seed   = 1962; { A seed for the random number generator }
  4900.   NumPts = 2000; { The number of pixels plotted }
  4901.   Esc    = #27;
  4902. var
  4903.   I : word;
  4904.   X, Y, Color : word;
  4905.   XMax, YMax  : integer;
  4906.   ViewInfo    : ViewPortType;
  4907. begin
  4908.   MainWindow('PutPixel / GetPixel demonstration');
  4909.   StatusLine('Esc aborts or press a key...');
  4910.  
  4911.   GetViewSettings(ViewInfo);
  4912.   with ViewInfo do
  4913.   begin
  4914.     XMax := (x2-x1-1);
  4915.     YMax := (y2-y1-1);
  4916.   end;
  4917.  
  4918.   while not KeyPressed do
  4919.   begin
  4920.     { Plot random pixels }
  4921.     RandSeed := Seed;
  4922.     I := 0;
  4923.     while (not KeyPressed) and (I < NumPts) do
  4924.     begin
  4925.       Inc(I);
  4926.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  4927.     end;
  4928.  
  4929.     { Erase pixels }
  4930.     RandSeed := Seed;
  4931.     I := 0;
  4932.     while (not KeyPressed) and (I < NumPts) do
  4933.     begin
  4934.       Inc(I);
  4935.       X := Random(XMax)+1;
  4936.       Y := Random(YMax)+1;
  4937.       Color := GetPixel(X, Y);
  4938.         if Color = RandColor then
  4939.           PutPixel(X, Y, 0);
  4940.      end;
  4941.   end;
  4942.   WaitToGo;
  4943. end; { PutPixelPlay }
  4944.  
  4945. procedure PutImagePlay;
  4946. { Demonstrate the GetImage and PutImage commands }
  4947.  
  4948. const
  4949.   r  = 20;
  4950.   StartX = 100;
  4951.   StartY = 50;
  4952.  
  4953. var
  4954.   CurPort : ViewPortType;
  4955.  
  4956. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  4957. var
  4958.   Step : integer;
  4959. begin
  4960.   Step := Random(2*r);
  4961.   if Odd(Step) then
  4962.     Step := -Step;
  4963.   X := X + Step;
  4964.   Step := Random(r);
  4965.   if Odd(Step) then
  4966.     Step := -Step;
  4967.   Y := Y + Step;
  4968.  
  4969.   { Make saucer bounce off viewport walls }
  4970.   with CurPort do
  4971.   begin
  4972.     if (x1 + X + Width - 1 > x2) then
  4973.       X := x2-x1 - Width + 1
  4974.     else
  4975.       if (X < 0) then
  4976.         X := 0;
  4977.     if (y1 + Y + Height - 1 > y2) then
  4978.       Y := y2-y1 - Height + 1
  4979.     else
  4980.       if (Y < 0) then
  4981.         Y := 0;
  4982.   end;
  4983. end; { MoveSaucer }
  4984.  
  4985. var
  4986.   Pausetime : word;
  4987.   Saucer    : pointer;
  4988.   X, Y      : integer;
  4989.   ulx, uly  : word;
  4990.   lrx, lry  : word;
  4991.   Size      : word;
  4992.   I         : word;
  4993. begin
  4994.   ClearDevice;
  4995.   FullPort;
  4996.  
  4997.   { PaintScreen }
  4998.   ClearDevice;
  4999.   MainWindow('GetImage / PutImage Demonstration');
  5000.   StatusLine('Esc aborts or press a key...');
  5001.   GetViewSettings(CurPort);
  5002.  
  5003.   { DrawSaucer }
  5004.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  5005.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  5006.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  5007.   Circle(StartX+10, StartY-12, 2);
  5008.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  5009.   Circle(StartX-10, StartY-12, 2);
  5010.   SetFillStyle(SolidFill, MaxColor);
  5011.   FloodFill(StartX+1, StartY+4, GetColor);
  5012.  
  5013.   { ReadSaucerImage }
  5014.   ulx := StartX-(r+1);
  5015.   uly := StartY-14;
  5016.   lrx := StartX+(r+1);
  5017.   lry := StartY+(r div 3)+3;
  5018.  
  5019.   Size := ImageSize(ulx, uly, lrx, lry);
  5020.   GetMem(Saucer, Size);
  5021.   GetImage(ulx, uly, lrx, lry, Saucer^);
  5022. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  5023.  
  5024.   { Plot some "stars" }
  5025.   for I := 1 to 1000 do
  5026.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  5027.   X := MaxX div 2;
  5028.   Y := MaxY div 2;
  5029.   PauseTime := 70;
  5030.  
  5031.   { Move the saucer around }
  5032.   repeat
  5033. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  5034.      Delay(PauseTime);
  5035. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  5036.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  5037.   until KeyPressed;
  5038.   FreeMem(Saucer, size);
  5039.   WaitToGo;
  5040. end; { PutImagePlay }
  5041.  
  5042. procedure PolyPlay;
  5043. { Draw random polygons with random fill styles on the screen }
  5044. const
  5045.   MaxPts = 5;
  5046. type
  5047.   PolygonType = array[1..MaxPts] of PointType;
  5048. var
  5049.   Poly : PolygonType;
  5050.   I, Color : word;
  5051. begin
  5052.   MainWindow('FillPoly demonstration');
  5053.   StatusLine('Esc aborts or press a key...');
  5054.   repeat
  5055.     Color := RandColor;
  5056.     SetFillStyle(Random(11)+1, Color);
  5057.     SetColor(Color);
  5058.     for I := 1 to MaxPts do
  5059.       with Poly[I] do
  5060.       begin
  5061.         X := Random(MaxX);
  5062.         Y := Random(MaxY);
  5063.       end;
  5064.     FillPoly(MaxPts, Poly);
  5065.   until KeyPressed;
  5066.   WaitToGo;
  5067. end; { PolyPlay }
  5068.  
  5069. procedure FillStylePlay;
  5070. { Display all of the predefined fill styles available }
  5071. var
  5072.   Style    : word;
  5073.   Width    : word;
  5074.   Height   : word;
  5075.   X, Y     : word;
  5076.   I, J     : word;
  5077.   ViewInfo : ViewPortType;
  5078.  
  5079. procedure DrawBox(X, Y : word);
  5080. begin
  5081.   SetFillStyle(Style, MaxColor);
  5082.   with ViewInfo do
  5083.     Bar(X, Y, X+Width, Y+Height);
  5084.   Rectangle(X, Y, X+Width, Y+Height);
  5085.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  5086.   Inc(Style);
  5087. end; { DrawBox }
  5088.  
  5089. begin
  5090.   MainWindow('Pre-defined fill styles');
  5091.   GetViewSettings(ViewInfo);
  5092.   with ViewInfo do
  5093.   begin
  5094.     Width := 2 * ((x2+1) div 13);
  5095.     Height := 2 * ((y2-10) div 10);
  5096.   end;
  5097.   X := Width div 2;
  5098.   Y := Height div 2;
  5099.   Style := 0;
  5100.   for J := 1 to 3 do
  5101.   begin
  5102.     for I := 1 to 4 do
  5103.     begin
  5104.       DrawBox(X, Y);
  5105.       Inc(X, (Width div 2) * 3);
  5106.     end;
  5107.     X := Width div 2;
  5108.     Inc(Y, (Height div 2) * 3);
  5109.   end;
  5110.   SetTextJustify(LeftText, TopText);
  5111.   WaitToGo;
  5112. end; { FillStylePlay }
  5113.  
  5114. procedure FillPatternPlay;
  5115. { Display some user defined fill patterns }
  5116. const
  5117.   Patterns : array[0..11] of FillPatternType = (
  5118.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  5119.             OldColor which has a path of pixels of OldColor or NewColor
  5120.             with sides touching back to the seed point, (XSeed, YSeed).
  5121.             Therefore, only pixels of OldColor are modified and no other
  5122.             information is changed.
  5123.  
  5124.             SEE ALSO
  5125.  
  5126.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  5127.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  5128.             SETVIEW
  5129.  
  5130.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  5131.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  5132.             IF WHICHVGA = 0 THEN STOP
  5133.             DUMMY=RES640
  5134.             SETVIEW 100, 100, 539, 379
  5135.             FILLVIEW 10
  5136.             WHILE INKEY$ = ""
  5137.             WEND
  5138.             VIDEOMODESET VMODE
  5139.             END
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.                                                                          63
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.  
  5163.           FONTGETINFO
  5164.  
  5165.             PROTOTYPE
  5166.  
  5167.             SUB FONTGETINFO (Width%, Height%)
  5168.  
  5169.             INPUT
  5170.  
  5171.             no input parameters
  5172.     WEND
  5173.             MOUSEEXIT
  5174.             VIDEOMODESET VMODE
  5175.             END
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.                                                                          86
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.           MOUSECURSORDEFAULT
  5224.  
  5225.             PROTOTYPE
  5226.  
  5227.             SUB MOUSECURSORDEFAULT ()
  5228.  
  5229.             INPUT
  5230.  
  5231.             no input parameters
  5232.  
  5233.             OUTPUT
  5234.  
  5235.             no value returned
  5236.  
  5237.             USAGE
  5238.  
  5239.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5240.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  5241. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  5242. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  5243. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  5244. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  5245. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  5246. $╤
  5247. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  5248. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  5249. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  5250. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  5251. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  5252. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  5253. ░£▒
  5254. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  5255. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  5256.       end;
  5257.     end;
  5258.   end;
  5259.   WaitToGo;
  5260. end; { UserLineStylePlay }
  5261.  
  5262.  
  5263. procedure SayGoodbye;
  5264. { Say goodbye and then exit the program }
  5265. var
  5266.   ViewInfo : ViewPortType;
  5267. begin
  5268.   MainWindow('');
  5269.   GetViewSettings(ViewInfo);
  5270.   SetTextStyle(TriplexFont, HorizDir, 4);
  5271.   SetTextJustify(CenterText, CenterText);
  5272.   with ViewInfo do
  5273.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  5274.   StatusLine('Press any key to quit...');
  5275.   repeat until KeyPressed;
  5276. end; { SayGoodbye }
  5277.  
  5278.  
  5279. PROCEDURE SelectMode;
  5280. VAR
  5281.     choice1,choice2     : CHAR;
  5282.    xsize,ysize            : WORD;
  5283. BEGIN
  5284.     (* Let's select a mode *)
  5285.     ClrScr;
  5286.     WriteLn('VESADEMO:');
  5287.     WriteLn('1. 256 colors');
  5288.     WriteLn('2. 32768 colors');
  5289.     WriteLn('3. 65536 colors');
  5290.     WriteLn('4. 16777216 colors');
  5291.     WriteLn('Q uit');
  5292.     WriteLn;
  5293.     Write('Your choice: ');
  5294.     REPEAT
  5295.         ReadLn(choice1);
  5296.       IF choice1 <> '1' THEN BEGIN
  5297.           WriteLn('Sorry !');
  5298.          WriteLn('This demo wasn''t written for more as 256 colors !');
  5299.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  5300.          WriteLn('Switching to 256 colors.');
  5301.          choice1 := '1';
  5302.       END;
  5303.     UNTIL choice1 IN ['1'..'4','q'];
  5304.     IF choice1 = 'q' THEN Halt;
  5305.  
  5306.     WriteLn;
  5307.     WriteLn;
  5308.     WriteLn('a. 320x200');
  5309.     WriteLn('b. 640x480');
  5310.     WriteLn('c. 800x600');
  5311.     WriteLn('d. 1024x768');
  5312.     WriteLn('e. 1280x1024');
  5313.     WriteLn('Q uit');
  5314.     WriteLn;
  5315.     Write('Your choice: ');
  5316.     REPEAT
  5317.         ReadLn(choice2);
  5318.     UNTIL choice2 IN ['a'..'e','q'];
  5319.     IF choice2 = 'q' THEN Halt;
  5320.  
  5321.     CASE choice2 OF
  5322.         'a' : BEGIN
  5323.             xsize := 320;
  5324.             ysize := 200;
  5325.         END;
  5326.         'b' : BEGIN
  5327.             xsize := 640;
  5328.             ysize := 480;
  5329.         END;
  5330.         'c' : BEGIN
  5331.             xsize := 800;
  5332.             ysize := 600;
  5333.         END;
  5334.         'd' : BEGIN
  5335.             xsize := 1024;
  5336.             ysize := 768;
  5337.         END;
  5338.         'e' : BEGIN
  5339.             xsize := 1280;
  5340.             ysize := 1024;
  5341.         END;
  5342.     END;
  5343.     CASE choice1 OF
  5344.         '1' : mode := FindVesaMode(xsize,ysize,8);
  5345.         '2' : mode := FindVesaMode(xsize,ysize,15);
  5346.         '3' : mode := FindVesaMode(xsize,ysize,16);
  5347.         '4' : mode := FindVesaMode(xsize,ysize,24);
  5348.     END;
  5349.     IF mode = 0 THEN BEGIN
  5350.         WriteLn('No such mode could be found !');
  5351.         WriteLn('Switching to to 320x200.');
  5352.         ReadKey;
  5353.         mode := V320x200x256;
  5354.     END;
  5355. END;
  5356.  
  5357. begin { program body }
  5358.   SelectMode;
  5359.   Initialize;
  5360.   ReportStatus;
  5361.  
  5362. {  AspectRatioPlay; }
  5363.   FillEllipsePlay;
  5364.   SectorPlay;
  5365.   WriteModePlay;
  5366.  
  5367.   ColorPlay;
  5368.   { PalettePlay only intended to work on these drivers: }
  5369.   if (GraphDriver = EGA) or
  5370.       (GraphDriver = EGA64) or
  5371.       (GraphDriver = VGA) then
  5372.      PalettePlay;
  5373.   PutPixelPlay;
  5374. {  PutImagePlay; }
  5375.   RandBarPlay;
  5376.   BarPlay;
  5377.   Bar3DPlay;
  5378.   ArcPlay;
  5379.   CirclePlay;
  5380.   PiePlay;
  5381.   LineToPlay;
  5382.   LineRelPlay;
  5383. {  LineStylePlay; }
  5384. {  UserLineStylePlay; }
  5385.   TextDump;
  5386.   TextPlay;
  5387.   CrtModePlay;
  5388.   FillStylePlay;
  5389.   FillPatternPlay;
  5390.   PolyPlay;
  5391.   SayGoodbye;
  5392. {  CloseGraph; }
  5393.   CloseVesa;
  5394. end.
  5395. ***************************************************
  5396.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  5397.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  5398. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  5399. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  5400. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  5401. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  5402.     Color := RandColor;
  5403.     SetColor(Color);
  5404.     SetFillStyle(Random(CloseDotFill)+1, Color);
  5405.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  5406.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  5407.   until KeyPressed;
  5408.   WaitToGo;
  5409. end; { RandBarPlay }
  5410.  
  5411. procedure ArcPlay;
  5412. { Draw random arcs on the screen }
  5413. var
  5414.   MaxRadius : word;
  5415.   EndAngle : word;
  5416.   ArcInfo : ArcCoordsType;
  5417. begin
  5418.   MainWindow('Arc / GetArcCoords demonstration');
  5419.   StatusLine('Esc aborts or press a key');
  5420.   MaxRadius := MaxY div 10;
  5421.   repeat
  5422.     SetColor(RandColor);
  5423.     EndAngle := Random(360);
  5424.     SetLineStyle(SolidLn, 0, NormWidth);
  5425.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  5426.     GetArcCoords(ArcInfo);
  5427.     with ArcInfo do
  5428.     begin
  5429.       Line(X, Y, XStart, YStart);
  5430.       Line(X, Y, Xend, Yend);
  5431.     end;
  5432.   until KeyPressed;
  5433.   WaitToGo;
  5434. end; { ArcPlay }
  5435.  
  5436. procedure PutPixelPlay;
  5437. { Demonstrate the PutPixel and GetPixel commands }
  5438. const
  5439.   Seed   = 1962; { A seed for the random number generator }
  5440.   NumPts = 2000; { The number of pixels plotted }
  5441.   Esc    = #27;
  5442. var
  5443.   I : word;
  5444.   X, Y, Color : word;
  5445.   XMax, YMax  : integer;
  5446.   ViewInfo    : ViewPortType;
  5447. begin
  5448.   MainWindow('PutPixel / GetPixel demonstration');
  5449.   StatusLine('Esc aborts or press a key...');
  5450.  
  5451.   GetViewSettings(ViewInfo);
  5452.   with ViewInfo do
  5453.   begin
  5454.     XMax := (x2-x1-1);
  5455.     YMax := (y2-y1-1);
  5456.   end;
  5457.  
  5458.   while not KeyPressed do
  5459.   begin
  5460.     { Plot random pixels }
  5461.     RandSeed := Seed;
  5462.     I := 0;
  5463.     while (not KeyPressed) and (I < NumPts) do
  5464.     begin
  5465.       Inc(I);
  5466.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  5467.     end;
  5468.  
  5469.     { Erase pixels }
  5470.     RandSeed := Seed;
  5471.     I := 0;
  5472.     while (not KeyPressed) and (I < NumPts) do
  5473.     begin
  5474.       Inc(I);
  5475.       X := Random(XMax)+1;
  5476.       Y := Random(YMax)+1;
  5477.       Color := GetPixel(X, Y);
  5478.         if Color = RandColor then
  5479.           PutPixel(X, Y, 0);
  5480.      end;
  5481.   end;
  5482.   WaitToGo;
  5483. end; { PutPixelPlay }
  5484.  
  5485. procedure PutImagePlay;
  5486. { Demonstrate the GetImage and PutImage commands }
  5487.  
  5488. const
  5489.   r  = 20;
  5490.   StartX = 100;
  5491.   StartY = 50;
  5492.  
  5493. var
  5494.   CurPort : ViewPortType;
  5495.  
  5496. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  5497. var
  5498.   Step : integer;
  5499. begin
  5500.   Step := Random(2*r);
  5501.   if Odd(Step) then
  5502.     Step := -Step;
  5503.   X := X + Step;
  5504.   Step := Random(r);
  5505.   if Odd(Step) then
  5506.     Step := -Step;
  5507.   Y := Y + Step;
  5508.  
  5509.   { Make saucer bounce off viewport walls }
  5510.   with CurPort do
  5511.   begin
  5512.     if (x1 + X + Width - 1 > x2) then
  5513.       X := x2-x1 - Width + 1
  5514.     else
  5515.       if (X < 0) then
  5516.         X := 0;
  5517.     if (y1 + Y + Height - 1 > y2) then
  5518.       Y := y2-y1 - Height + 1
  5519.     else
  5520.       if (Y < 0) then
  5521.         Y := 0;
  5522.   end;
  5523. end; { MoveSaucer }
  5524.  
  5525. var
  5526.   Pausetime : word;
  5527.   Saucer    : pointer;
  5528.   X, Y      : integer;
  5529.   ulx, uly  : word;
  5530.   lrx, lry  : word;
  5531.   Size      : word;
  5532.   I         : word;
  5533. begin
  5534.   ClearDevice;
  5535.   FullPort;
  5536.  
  5537.   { PaintScreen }
  5538.   ClearDevice;
  5539.   MainWindow('GetImage / PutImage Demonstration');
  5540.   StatusLine('Esc aborts or press a key...');
  5541.   GetViewSettings(CurPort);
  5542.  
  5543.   { DrawSaucer }
  5544.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  5545.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  5546.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  5547.   Circle(StartX+10, StartY-12, 2);
  5548.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  5549.   Circle(StartX-10, StartY-12, 2);
  5550.   SetFillStyle(SolidFill, MaxColor);
  5551.   FloodFill(StartX+1, StartY+4, GetColor);
  5552.  
  5553.   { ReadSaucerImage }
  5554.   ulx := StartX-(r+1);
  5555.   uly := StartY-14;
  5556.   lrx := StartX+(r+1);
  5557.   lry := StartY+(r div 3)+3;
  5558.  
  5559.   Size := ImageSize(ulx, uly, lrx, lry);
  5560.   GetMem(Saucer, Size);
  5561.   GetImage(ulx, uly, lrx, lry, Saucer^);
  5562. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  5563.  
  5564.   { Plot some "stars" }
  5565.   for I := 1 to 1000 do
  5566.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  5567.   X := MaxX div 2;
  5568.   Y := MaxY div 2;
  5569.   PauseTime := 70;
  5570.  
  5571.   { Move the saucer around }
  5572.   repeat
  5573. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  5574.      Delay(PauseTime);
  5575. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  5576.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  5577.   until KeyPressed;
  5578.   FreeMem(Saucer, size);
  5579.   WaitToGo;
  5580. end; { PutImagePlay }
  5581.  
  5582. procedure PolyPlay;
  5583. { Draw random polygons with random fill styles on the screen }
  5584. const
  5585.   MaxPts = 5;
  5586. type
  5587.   PolygonType = array[1..MaxPts] of PointType;
  5588. var
  5589.   Poly : PolygonType;
  5590.   I, Color : word;
  5591. begin
  5592.   MainWindow('FillPoly demonstration');
  5593.   StatusLine('Esc aborts or press a key...');
  5594.   repeat
  5595.     Color := RandColor;
  5596.     SetFillStyle(Random(11)+1, Color);
  5597.     SetColor(Color);
  5598.     for I := 1 to MaxPts do
  5599.       with Poly[I] do
  5600.       begin
  5601.         X := Random(MaxX);
  5602.         Y := Random(MaxY);
  5603.       end;
  5604.     FillPoly(MaxPts, Poly);
  5605.   until KeyPressed;
  5606.   WaitToGo;
  5607. end; { PolyPlay }
  5608.  
  5609. procedure FillStylePlay;
  5610. { Display all of the predefined fill styles available }
  5611. var
  5612.   Style    : word;
  5613.   Width    : word;
  5614.   Height   : word;
  5615.   X, Y     : word;
  5616.   I, J     : word;
  5617.   ViewInfo : ViewPortType;
  5618.  
  5619. procedure DrawBox(X, Y : word);
  5620. begin
  5621.   SetFillStyle(Style, MaxColor);
  5622.   with ViewInfo do
  5623.     Bar(X, Y, X+Width, Y+Height);
  5624.   Rectangle(X, Y, X+Width, Y+Height);
  5625.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  5626.   Inc(Style);
  5627. end; { DrawBox }
  5628.  
  5629. begin
  5630.   MainWindow('Pre-defined fill styles');
  5631.   GetViewSettings(ViewInfo);
  5632.   with ViewInfo do
  5633.   begin
  5634.     Width := 2 * ((x2+1) div 13);
  5635.     Height := 2 * ((y2-10) div 10);
  5636.   end;
  5637.   X := Width div 2;
  5638.   Y := Height div 2;
  5639.   Style := 0;
  5640.   for J := 1 to 3 do
  5641.   begin
  5642.     for I := 1 to 4 do
  5643.     begin
  5644.       DrawBox(X, Y);
  5645.       Inc(X, (Width div 2) * 3);
  5646.     end;
  5647.     X := Width div 2;
  5648.     Inc(Y, (Height div 2) * 3);
  5649.   end;
  5650.   SetTextJustify(LeftText, TopText);
  5651.   WaitToGo;
  5652. end; { FillStylePlay }
  5653.  
  5654. procedure FillPatternPlay;
  5655. { Display some user defined fill patterns }
  5656. const
  5657.   Patterns : array[0..11] of FillPatternType = (
  5658.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  5659.             OldColor which has a path of pixels of OldColor or NewColor
  5660.             with sides touching back to the seed point, (XSeed, YSeed).
  5661.             Therefore, only pixels of OldColor are modified and no other
  5662.             information is changed.
  5663.  
  5664.             SEE ALSO
  5665.  
  5666.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  5667.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  5668.             SETVIEW
  5669.  
  5670.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  5671.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  5672.             IF WHICHVGA = 0 THEN STOP
  5673.             DUMMY=RES640
  5674.             SETVIEW 100, 100, 539, 379
  5675.             FILLVIEW 10
  5676.             WHILE INKEY$ = ""
  5677.             WEND
  5678.             VIDEOMODESET VMODE
  5679.             END
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.  
  5687.  
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.                                                                          63
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.           FONTGETINFO
  5704.  
  5705.             PROTOTYPE
  5706.  
  5707.             SUB FONTGETINFO (Width%, Height%)
  5708.  
  5709.             INPUT
  5710.  
  5711.             no input parameters
  5712.     WEND
  5713.             MOUSEEXIT
  5714.             VIDEOMODESET VMODE
  5715.             END
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.                                                                          86
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.           MOUSECURSORDEFAULT
  5764.  
  5765.             PROTOTYPE
  5766.  
  5767.             SUB MOUSECURSORDEFAULT ()
  5768.  
  5769.             INPUT
  5770.  
  5771.             no input parameters
  5772.  
  5773.             OUTPUT
  5774.  
  5775.             no value returned
  5776.  
  5777.             USAGE
  5778.  
  5779.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5780.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  5781. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  5782. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  5783. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  5784. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  5785. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  5786. $╤
  5787. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  5788. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  5789. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  5790. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  5791. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  5792. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  5793. ░£▒
  5794. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  5795. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  5796.       end;
  5797.     end;
  5798.   end;
  5799.   WaitToGo;
  5800. end; { UserLineStylePlay }
  5801.  
  5802.  
  5803. procedure SayGoodbye;
  5804. { Say goodbye and then exit the program }
  5805. var
  5806.   ViewInfo : ViewPortType;
  5807. begin
  5808.   MainWindow('');
  5809.   GetViewSettings(ViewInfo);
  5810.   SetTextStyle(TriplexFont, HorizDir, 4);
  5811.   SetTextJustify(CenterText, CenterText);
  5812.   with ViewInfo do
  5813.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  5814.   StatusLine('Press any key to quit...');
  5815.   repeat until KeyPressed;
  5816. end; { SayGoodbye }
  5817.  
  5818.  
  5819. PROCEDURE SelectMode;
  5820. VAR
  5821.     choice1,choice2     : CHAR;
  5822.    xsize,ysize            : WORD;
  5823. BEGIN
  5824.     (* Let's select a mode *)
  5825.     ClrScr;
  5826.     WriteLn('VESADEMO:');
  5827.     WriteLn('1. 256 colors');
  5828.     WriteLn('2. 32768 colors');
  5829.     WriteLn('3. 65536 colors');
  5830.     WriteLn('4. 16777216 colors');
  5831.     WriteLn('Q uit');
  5832.     WriteLn;
  5833.     Write('Your choice: ');
  5834.     REPEAT
  5835.         ReadLn(choice1);
  5836.       IF choice1 <> '1' THEN BEGIN
  5837.           WriteLn('Sorry !');
  5838.          WriteLn('This demo wasn''t written for more as 256 colors !');
  5839.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  5840.          WriteLn('Switching to 256 colors.');
  5841.          choice1 := '1';
  5842.       END;
  5843.     UNTIL choice1 IN ['1'..'4','q'];
  5844.     IF choice1 = 'q' THEN Halt;
  5845.  
  5846.     WriteLn;
  5847.     WriteLn;
  5848.     WriteLn('a. 320x200');
  5849.     WriteLn('b. 640x480');
  5850.     WriteLn('c. 800x600');
  5851.     WriteLn('d. 1024x768');
  5852.     WriteLn('e. 1280x1024');
  5853.     WriteLn('Q uit');
  5854.     WriteLn;
  5855.     Write('Your choice: ');
  5856.     REPEAT
  5857.         ReadLn(choice2);
  5858.     UNTIL choice2 IN ['a'..'e','q'];
  5859.     IF choice2 = 'q' THEN Halt;
  5860.  
  5861.     CASE choice2 OF
  5862.         'a' : BEGIN
  5863.             xsize := 320;
  5864.             ysize := 200;
  5865.         END;
  5866.         'b' : BEGIN
  5867.             xsize := 640;
  5868.             ysize := 480;
  5869.         END;
  5870.         'c' : BEGIN
  5871.             xsize := 800;
  5872.             ysize := 600;
  5873.         END;
  5874.         'd' : BEGIN
  5875.             xsize := 1024;
  5876.             ysize := 768;
  5877.         END;
  5878.         'e' : BEGIN
  5879.             xsize := 1280;
  5880.             ysize := 1024;
  5881.         END;
  5882.     END;
  5883.     CASE choice1 OF
  5884.         '1' : mode := FindVesaMode(xsize,ysize,8);
  5885.         '2' : mode := FindVesaMode(xsize,ysize,15);
  5886.         '3' : mode := FindVesaMode(xsize,ysize,16);
  5887.         '4' : mode := FindVesaMode(xsize,ysize,24);
  5888.     END;
  5889.     IF mode = 0 THEN BEGIN
  5890.         WriteLn('No such mode could be found !');
  5891.         WriteLn('Switching to to 320x200.');
  5892.         ReadKey;
  5893.         mode := V320x200x256;
  5894.     END;
  5895. END;
  5896.  
  5897. begin { program body }
  5898.   SelectMode;
  5899.   Initialize;
  5900.   ReportStatus;
  5901.  
  5902. {  AspectRatioPlay; }
  5903.   FillEllipsePlay;
  5904.   SectorPlay;
  5905.   WriteModePlay;
  5906.  
  5907.   ColorPlay;
  5908.   { PalettePlay only intended to work on these drivers: }
  5909.   if (GraphDriver = EGA) or
  5910.       (GraphDriver = EGA64) or
  5911.       (GraphDriver = VGA) then
  5912.      PalettePlay;
  5913.   PutPixelPlay;
  5914. {  PutImagePlay; }
  5915.   RandBarPlay;
  5916.   BarPlay;
  5917.   Bar3DPlay;
  5918.   ArcPlay;
  5919.   CirclePlay;
  5920.   PiePlay;
  5921.   LineToPlay;
  5922.   LineRelPlay;
  5923. {  LineStylePlay; }
  5924. {  UserLineStylePlay; }
  5925.   TextDump;
  5926.   TextPlay;
  5927.   CrtModePlay;
  5928.   FillStylePlay;
  5929.   FillPatternPlay;
  5930.   PolyPlay;
  5931.   SayGoodbye;
  5932. {  CloseGraph; }
  5933.   CloseVesa;
  5934. end.
  5935. ***************************************************
  5936.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  5937.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  5938. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  5939. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  5940. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  5941. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  5942.     Color := RandColor;
  5943.     SetColor(Color);
  5944.     SetFillStyle(Random(CloseDotFill)+1, Color);
  5945.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  5946.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  5947.   until KeyPressed;
  5948.   WaitToGo;
  5949. end; { RandBarPlay }
  5950.  
  5951. procedure ArcPlay;
  5952. { Draw random arcs on the screen }
  5953. var
  5954.   MaxRadius : word;
  5955.   EndAngle : word;
  5956.   ArcInfo : ArcCoordsType;
  5957. begin
  5958.   MainWindow('Arc / GetArcCoords demonstration');
  5959.   StatusLine('Esc aborts or press a key');
  5960.   MaxRadius := MaxY div 10;
  5961.   repeat
  5962.     SetColor(RandColor);
  5963.     EndAngle := Random(360);
  5964.     SetLineStyle(SolidLn, 0, NormWidth);
  5965.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  5966.     GetArcCoords(ArcInfo);
  5967.     with ArcInfo do
  5968.     begin
  5969.       Line(X, Y, XStart, YStart);
  5970.       Line(X, Y, Xend, Yend);
  5971.     end;
  5972.   until KeyPressed;
  5973.   WaitToGo;
  5974. end; { ArcPlay }
  5975.  
  5976. procedure PutPixelPlay;
  5977. { Demonstrate the PutPixel and GetPixel commands }
  5978. const
  5979.   Seed   = 1962; { A seed for the random number generator }
  5980.   NumPts = 2000; { The number of pixels plotted }
  5981.   Esc    = #27;
  5982. var
  5983.   I : word;
  5984.   X, Y, Color : word;
  5985.   XMax, YMax  : integer;
  5986.   ViewInfo    : ViewPortType;
  5987. begin
  5988.   MainWindow('PutPixel / GetPixel demonstration');
  5989.   StatusLine('Esc aborts or press a key...');
  5990.  
  5991.   GetViewSettings(ViewInfo);
  5992.   with ViewInfo do
  5993.   begin
  5994.     XMax := (x2-x1-1);
  5995.     YMax := (y2-y1-1);
  5996.   end;
  5997.  
  5998.   while not KeyPressed do
  5999.   begin
  6000.     { Plot random pixels }
  6001.     RandSeed := Seed;
  6002.     I := 0;
  6003.     while (not KeyPressed) and (I < NumPts) do
  6004.     begin
  6005.       Inc(I);
  6006.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  6007.     end;
  6008.  
  6009.     { Erase pixels }
  6010.     RandSeed := Seed;
  6011.     I := 0;
  6012.     while (not KeyPressed) and (I < NumPts) do
  6013.     begin
  6014.       Inc(I);
  6015.       X := Random(XMax)+1;
  6016.       Y := Random(YMax)+1;
  6017.       Color := GetPixel(X, Y);
  6018.         if Color = RandColor then
  6019.           PutPixel(X, Y, 0);
  6020.      end;
  6021.   end;
  6022.   WaitToGo;
  6023. end; { PutPixelPlay }
  6024.  
  6025. procedure PutImagePlay;
  6026. { Demonstrate the GetImage and PutImage commands }
  6027.  
  6028. const
  6029.   r  = 20;
  6030.   StartX = 100;
  6031.   StartY = 50;
  6032.  
  6033. var
  6034.   CurPort : ViewPortType;
  6035.  
  6036. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  6037. var
  6038.   Step : integer;
  6039. begin
  6040.   Step := Random(2*r);
  6041.   if Odd(Step) then
  6042.     Step := -Step;
  6043.   X := X + Step;
  6044.   Step := Random(r);
  6045.   if Odd(Step) then
  6046.     Step := -Step;
  6047.   Y := Y + Step;
  6048.  
  6049.   { Make saucer bounce off viewport walls }
  6050.   with CurPort do
  6051.   begin
  6052.     if (x1 + X + Width - 1 > x2) then
  6053.       X := x2-x1 - Width + 1
  6054.     else
  6055.       if (X < 0) then
  6056.         X := 0;
  6057.     if (y1 + Y + Height - 1 > y2) then
  6058.       Y := y2-y1 - Height + 1
  6059.     else
  6060.       if (Y < 0) then
  6061.         Y := 0;
  6062.   end;
  6063. end; { MoveSaucer }
  6064.  
  6065. var
  6066.   Pausetime : word;
  6067.   Saucer    : pointer;
  6068.   X, Y      : integer;
  6069.   ulx, uly  : word;
  6070.   lrx, lry  : word;
  6071.   Size      : word;
  6072.   I         : word;
  6073. begin
  6074.   ClearDevice;
  6075.   FullPort;
  6076.  
  6077.   { PaintScreen }
  6078.   ClearDevice;
  6079.   MainWindow('GetImage / PutImage Demonstration');
  6080.   StatusLine('Esc aborts or press a key...');
  6081.   GetViewSettings(CurPort);
  6082.  
  6083.   { DrawSaucer }
  6084.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  6085.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  6086.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  6087.   Circle(StartX+10, StartY-12, 2);
  6088.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  6089.   Circle(StartX-10, StartY-12, 2);
  6090.   SetFillStyle(SolidFill, MaxColor);
  6091.   FloodFill(StartX+1, StartY+4, GetColor);
  6092.  
  6093.   { ReadSaucerImage }
  6094.   ulx := StartX-(r+1);
  6095.   uly := StartY-14;
  6096.   lrx := StartX+(r+1);
  6097.   lry := StartY+(r div 3)+3;
  6098.  
  6099.   Size := ImageSize(ulx, uly, lrx, lry);
  6100.   GetMem(Saucer, Size);
  6101.   GetImage(ulx, uly, lrx, lry, Saucer^);
  6102. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  6103.  
  6104.   { Plot some "stars" }
  6105.   for I := 1 to 1000 do
  6106.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  6107.   X := MaxX div 2;
  6108.   Y := MaxY div 2;
  6109.   PauseTime := 70;
  6110.  
  6111.   { Move the saucer around }
  6112.   repeat
  6113. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  6114.      Delay(PauseTime);
  6115. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  6116.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  6117.   until KeyPressed;
  6118.   FreeMem(Saucer, size);
  6119.   WaitToGo;
  6120. end; { PutImagePlay }
  6121.  
  6122. procedure PolyPlay;
  6123. { Draw random polygons with random fill styles on the screen }
  6124. const
  6125.   MaxPts = 5;
  6126. type
  6127.   PolygonType = array[1..MaxPts] of PointType;
  6128. var
  6129.   Poly : PolygonType;
  6130.   I, Color : word;
  6131. begin
  6132.   MainWindow('FillPoly demonstration');
  6133.   StatusLine('Esc aborts or press a key...');
  6134.   repeat
  6135.     Color := RandColor;
  6136.     SetFillStyle(Random(11)+1, Color);
  6137.     SetColor(Color);
  6138.     for I := 1 to MaxPts do
  6139.       with Poly[I] do
  6140.       begin
  6141.         X := Random(MaxX);
  6142.         Y := Random(MaxY);
  6143.       end;
  6144.     FillPoly(MaxPts, Poly);
  6145.   until KeyPressed;
  6146.   WaitToGo;
  6147. end; { PolyPlay }
  6148.  
  6149. procedure FillStylePlay;
  6150. { Display all of the predefined fill styles available }
  6151. var
  6152.   Style    : word;
  6153.   Width    : word;
  6154.   Height   : word;
  6155.   X, Y     : word;
  6156.   I, J     : word;
  6157.   ViewInfo : ViewPortType;
  6158.  
  6159. procedure DrawBox(X, Y : word);
  6160. begin
  6161.   SetFillStyle(Style, MaxColor);
  6162.   with ViewInfo do
  6163.     Bar(X, Y, X+Width, Y+Height);
  6164.   Rectangle(X, Y, X+Width, Y+Height);
  6165.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  6166.   Inc(Style);
  6167. end; { DrawBox }
  6168.  
  6169. begin
  6170.   MainWindow('Pre-defined fill styles');
  6171.   GetViewSettings(ViewInfo);
  6172.   with ViewInfo do
  6173.   begin
  6174.     Width := 2 * ((x2+1) div 13);
  6175.     Height := 2 * ((y2-10) div 10);
  6176.   end;
  6177.   X := Width div 2;
  6178.   Y := Height div 2;
  6179.   Style := 0;
  6180.   for J := 1 to 3 do
  6181.   begin
  6182.     for I := 1 to 4 do
  6183.     begin
  6184.       DrawBox(X, Y);
  6185.       Inc(X, (Width div 2) * 3);
  6186.     end;
  6187.     X := Width div 2;
  6188.     Inc(Y, (Height div 2) * 3);
  6189.   end;
  6190.   SetTextJustify(LeftText, TopText);
  6191.   WaitToGo;
  6192. end; { FillStylePlay }
  6193.  
  6194. procedure FillPatternPlay;
  6195. { Display some user defined fill patterns }
  6196. const
  6197.   Patterns : array[0..11] of FillPatternType = (
  6198.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  6199.             OldColor which has a path of pixels of OldColor or NewColor
  6200.             with sides touching back to the seed point, (XSeed, YSeed).
  6201.             Therefore, only pixels of OldColor are modified and no other
  6202.             information is changed.
  6203.  
  6204.             SEE ALSO
  6205.  
  6206.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  6207.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  6208.             SETVIEW
  6209.  
  6210.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  6211.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  6212.             IF WHICHVGA = 0 THEN STOP
  6213.             DUMMY=RES640
  6214.             SETVIEW 100, 100, 539, 379
  6215.             FILLVIEW 10
  6216.             WHILE INKEY$ = ""
  6217.             WEND
  6218.             VIDEOMODESET VMODE
  6219.             END
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.                                                                          63
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.           FONTGETINFO
  6244.  
  6245.             PROTOTYPE
  6246.  
  6247.             SUB FONTGETINFO (Width%, Height%)
  6248.  
  6249.             INPUT
  6250.  
  6251.             no input parameters
  6252.     WEND
  6253.             MOUSEEXIT
  6254.             VIDEOMODESET VMODE
  6255.             END
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.  
  6280.  
  6281.  
  6282.  
  6283.  
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.  
  6290.  
  6291.  
  6292.  
  6293.  
  6294.  
  6295.  
  6296.                                                                          86
  6297.  
  6298.  
  6299.  
  6300.  
  6301.  
  6302.  
  6303.           MOUSECURSORDEFAULT
  6304.  
  6305.             PROTOTYPE
  6306.  
  6307.             SUB MOUSECURSORDEFAULT ()
  6308.  
  6309.             INPUT
  6310.  
  6311.             no input parameters
  6312.  
  6313.             OUTPUT
  6314.  
  6315.             no value returned
  6316.  
  6317.             USAGE
  6318.  
  6319.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  6320.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  6321. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  6322. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  6323. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  6324. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  6325. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  6326. $╤
  6327. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  6328. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  6329. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  6330. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  6331. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  6332. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  6333. ░£▒
  6334. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  6335. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  6336.       end;
  6337.     end;
  6338.   end;
  6339.   WaitToGo;
  6340. end; { UserLineStylePlay }
  6341.  
  6342.  
  6343. procedure SayGoodbye;
  6344. { Say goodbye and then exit the program }
  6345. var
  6346.   ViewInfo : ViewPortType;
  6347. begin
  6348.   MainWindow('');
  6349.   GetViewSettings(ViewInfo);
  6350.   SetTextStyle(TriplexFont, HorizDir, 4);
  6351.   SetTextJustify(CenterText, CenterText);
  6352.   with ViewInfo do
  6353.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  6354.   StatusLine('Press any key to quit...');
  6355.   repeat until KeyPressed;
  6356. end; { SayGoodbye }
  6357.  
  6358.  
  6359. PROCEDURE SelectMode;
  6360. VAR
  6361.     choice1,choice2     : CHAR;
  6362.    xsize,ysize            : WORD;
  6363. BEGIN
  6364.     (* Let's select a mode *)
  6365.     ClrScr;
  6366.     WriteLn('VESADEMO:');
  6367.     WriteLn('1. 256 colors');
  6368.     WriteLn('2. 32768 colors');
  6369.     WriteLn('3. 65536 colors');
  6370.     WriteLn('4. 16777216 colors');
  6371.     WriteLn('Q uit');
  6372.     WriteLn;
  6373.     Write('Your choice: ');
  6374.     REPEAT
  6375.         ReadLn(choice1);
  6376.       IF choice1 <> '1' THEN BEGIN
  6377.           WriteLn('Sorry !');
  6378.          WriteLn('This demo wasn''t written for more as 256 colors !');
  6379.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  6380.          WriteLn('Switching to 256 colors.');
  6381.          choice1 := '1';
  6382.       END;
  6383.     UNTIL choice1 IN ['1'..'4','q'];
  6384.     IF choice1 = 'q' THEN Halt;
  6385.  
  6386.     WriteLn;
  6387.     WriteLn;
  6388.     WriteLn('a. 320x200');
  6389.     WriteLn('b. 640x480');
  6390.     WriteLn('c. 800x600');
  6391.     WriteLn('d. 1024x768');
  6392.     WriteLn('e. 1280x1024');
  6393.     WriteLn('Q uit');
  6394.     WriteLn;
  6395.     Write('Your choice: ');
  6396.     REPEAT
  6397.         ReadLn(choice2);
  6398.     UNTIL choice2 IN ['a'..'e','q'];
  6399.     IF choice2 = 'q' THEN Halt;
  6400.  
  6401.     CASE choice2 OF
  6402.         'a' : BEGIN
  6403.             xsize := 320;
  6404.             ysize := 200;
  6405.         END;
  6406.         'b' : BEGIN
  6407.             xsize := 640;
  6408.             ysize := 480;
  6409.         END;
  6410.         'c' : BEGIN
  6411.             xsize := 800;
  6412.             ysize := 600;
  6413.         END;
  6414.         'd' : BEGIN
  6415.             xsize := 1024;
  6416.             ysize := 768;
  6417.         END;
  6418.         'e' : BEGIN
  6419.             xsize := 1280;
  6420.             ysize := 1024;
  6421.         END;
  6422.     END;
  6423.     CASE choice1 OF
  6424.         '1' : mode := FindVesaMode(xsize,ysize,8);
  6425.         '2' : mode := FindVesaMode(xsize,ysize,15);
  6426.         '3' : mode := FindVesaMode(xsize,ysize,16);
  6427.         '4' : mode := FindVesaMode(xsize,ysize,24);
  6428.     END;
  6429.     IF mode = 0 THEN BEGIN
  6430.         WriteLn('No such mode could be found !');
  6431.         WriteLn('Switching to to 320x200.');
  6432.         ReadKey;
  6433.         mode := V320x200x256;
  6434.     END;
  6435. END;
  6436.  
  6437. begin { program body }
  6438.   SelectMode;
  6439.   Initialize;
  6440.   ReportStatus;
  6441.  
  6442. {  AspectRatioPlay; }
  6443.   FillEllipsePlay;
  6444.   SectorPlay;
  6445.   WriteModePlay;
  6446.  
  6447.   ColorPlay;
  6448.   { PalettePlay only intended to work on these drivers: }
  6449.   if (GraphDriver = EGA) or
  6450.       (GraphDriver = EGA64) or
  6451.       (GraphDriver = VGA) then
  6452.      PalettePlay;
  6453.   PutPixelPlay;
  6454. {  PutImagePlay; }
  6455.   RandBarPlay;
  6456.   BarPlay;
  6457.   Bar3DPlay;
  6458.   ArcPlay;
  6459.   CirclePlay;
  6460.   PiePlay;
  6461.   LineToPlay;
  6462.   LineRelPlay;
  6463. {  LineStylePlay; }
  6464. {  UserLineStylePlay; }
  6465.   TextDump;
  6466.   TextPlay;
  6467.   CrtModePlay;
  6468.   FillStylePlay;
  6469.   FillPatternPlay;
  6470.   PolyPlay;
  6471.   SayGoodbye;
  6472. {  CloseGraph; }
  6473.   CloseVesa;
  6474. end.
  6475. ***************************************************
  6476.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  6477.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  6478. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  6479. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  6480. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  6481. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  6482.     Color := RandColor;
  6483.     SetColor(Color);
  6484.     SetFillStyle(Random(CloseDotFill)+1, Color);
  6485.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  6486.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  6487.   until KeyPressed;
  6488.   WaitToGo;
  6489. end; { RandBarPlay }
  6490.  
  6491. procedure ArcPlay;
  6492. { Draw random arcs on the screen }
  6493. var
  6494.   MaxRadius : word;
  6495.   EndAngle : word;
  6496.   ArcInfo : ArcCoordsType;
  6497. begin
  6498.   MainWindow('Arc / GetArcCoords demonstration');
  6499.   StatusLine('Esc aborts or press a key');
  6500.   MaxRadius := MaxY div 10;
  6501.   repeat
  6502.     SetColor(RandColor);
  6503.     EndAngle := Random(360);
  6504.     SetLineStyle(SolidLn, 0, NormWidth);
  6505.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  6506.     GetArcCoords(ArcInfo);
  6507.     with ArcInfo do
  6508.     begin
  6509.       Line(X, Y, XStart, YStart);
  6510.       Line(X, Y, Xend, Yend);
  6511.     end;
  6512.   until KeyPressed;
  6513.   WaitToGo;
  6514. end; { ArcPlay }
  6515.  
  6516. procedure PutPixelPlay;
  6517. { Demonstrate the PutPixel and GetPixel commands }
  6518. const
  6519.   Seed   = 1962; { A seed for the random number generator }
  6520.   NumPts = 2000; { The number of pixels plotted }
  6521.   Esc    = #27;
  6522. var
  6523.   I : word;
  6524.   X, Y, Color : word;
  6525.   XMax, YMax  : integer;
  6526.   ViewInfo    : ViewPortType;
  6527. begin
  6528.   MainWindow('PutPixel / GetPixel demonstration');
  6529.   StatusLine('Esc aborts or press a key...');
  6530.  
  6531.   GetViewSettings(ViewInfo);
  6532.   with ViewInfo do
  6533.   begin
  6534.     XMax := (x2-x1-1);
  6535.     YMax := (y2-y1-1);
  6536.   end;
  6537.  
  6538.   while not KeyPressed do
  6539.   begin
  6540.     { Plot random pixels }
  6541.     RandSeed := Seed;
  6542.     I := 0;
  6543.     while (not KeyPressed) and (I < NumPts) do
  6544.     begin
  6545.       Inc(I);
  6546.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  6547.     end;
  6548.  
  6549.     { Erase pixels }
  6550.     RandSeed := Seed;
  6551.     I := 0;
  6552.     while (not KeyPressed) and (I < NumPts) do
  6553.     begin
  6554.       Inc(I);
  6555.       X := Random(XMax)+1;
  6556.       Y := Random(YMax)+1;
  6557.       Color := GetPixel(X, Y);
  6558.         if Color = RandColor then
  6559.           PutPixel(X, Y, 0);
  6560.      end;
  6561.   end;
  6562.   WaitToGo;
  6563. end; { PutPixelPlay }
  6564.  
  6565. procedure PutImagePlay;
  6566. { Demonstrate the GetImage and PutImage commands }
  6567.  
  6568. const
  6569.   r  = 20;
  6570.   StartX = 100;
  6571.   StartY = 50;
  6572.  
  6573. var
  6574.   CurPort : ViewPortType;
  6575.  
  6576. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  6577. var
  6578.   Step : integer;
  6579. begin
  6580.   Step := Random(2*r);
  6581.   if Odd(Step) then
  6582.     Step := -Step;
  6583.   X := X + Step;
  6584.   Step := Random(r);
  6585.   if Odd(Step) then
  6586.     Step := -Step;
  6587.   Y := Y + Step;
  6588.  
  6589.   { Make saucer bounce off viewport walls }
  6590.   with CurPort do
  6591.   begin
  6592.     if (x1 + X + Width - 1 > x2) then
  6593.       X := x2-x1 - Width + 1
  6594.     else
  6595.       if (X < 0) then
  6596.         X := 0;
  6597.     if (y1 + Y + Height - 1 > y2) then
  6598.       Y := y2-y1 - Height + 1
  6599.     else
  6600.       if (Y < 0) then
  6601.         Y := 0;
  6602.   end;
  6603. end; { MoveSaucer }
  6604.  
  6605. var
  6606.   Pausetime : word;
  6607.   Saucer    : pointer;
  6608.   X, Y      : integer;
  6609.   ulx, uly  : word;
  6610.   lrx, lry  : word;
  6611.   Size      : word;
  6612.   I         : word;
  6613. begin
  6614.   ClearDevice;
  6615.   FullPort;
  6616.  
  6617.   { PaintScreen }
  6618.   ClearDevice;
  6619.   MainWindow('GetImage / PutImage Demonstration');
  6620.   StatusLine('Esc aborts or press a key...');
  6621.   GetViewSettings(CurPort);
  6622.  
  6623.   { DrawSaucer }
  6624.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  6625.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  6626.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  6627.   Circle(StartX+10, StartY-12, 2);
  6628.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  6629.   Circle(StartX-10, StartY-12, 2);
  6630.   SetFillStyle(SolidFill, MaxColor);
  6631.   FloodFill(StartX+1, StartY+4, GetColor);
  6632.  
  6633.   { ReadSaucerImage }
  6634.   ulx := StartX-(r+1);
  6635.   uly := StartY-14;
  6636.   lrx := StartX+(r+1);
  6637.   lry := StartY+(r div 3)+3;
  6638.  
  6639.   Size := ImageSize(ulx, uly, lrx, lry);
  6640.   GetMem(Saucer, Size);
  6641.   GetImage(ulx, uly, lrx, lry, Saucer^);
  6642. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  6643.  
  6644.   { Plot some "stars" }
  6645.   for I := 1 to 1000 do
  6646.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  6647.   X := MaxX div 2;
  6648.   Y := MaxY div 2;
  6649.   PauseTime := 70;
  6650.  
  6651.   { Move the saucer around }
  6652.   repeat
  6653. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  6654.      Delay(PauseTime);
  6655. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  6656.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  6657.   until KeyPressed;
  6658.   FreeMem(Saucer, size);
  6659.   WaitToGo;
  6660. end; { PutImagePlay }
  6661.  
  6662. procedure PolyPlay;
  6663. { Draw random polygons with random fill styles on the screen }
  6664. const
  6665.   MaxPts = 5;
  6666. type
  6667.   PolygonType = array[1..MaxPts] of PointType;
  6668. var
  6669.   Poly : PolygonType;
  6670.   I, Color : word;
  6671. begin
  6672.   MainWindow('FillPoly demonstration');
  6673.   StatusLine('Esc aborts or press a key...');
  6674.   repeat
  6675.     Color := RandColor;
  6676.     SetFillStyle(Random(11)+1, Color);
  6677.     SetColor(Color);
  6678.     for I := 1 to MaxPts do
  6679.       with Poly[I] do
  6680.       begin
  6681.         X := Random(MaxX);
  6682.         Y := Random(MaxY);
  6683.       end;
  6684.     FillPoly(MaxPts, Poly);
  6685.   until KeyPressed;
  6686.   WaitToGo;
  6687. end; { PolyPlay }
  6688.  
  6689. procedure FillStylePlay;
  6690. { Display all of the predefined fill styles available }
  6691. var
  6692.   Style    : word;
  6693.   Width    : word;
  6694.   Height   : word;
  6695.   X, Y     : word;
  6696.   I, J     : word;
  6697.   ViewInfo : ViewPortType;
  6698.  
  6699. procedure DrawBox(X, Y : word);
  6700. begin
  6701.   SetFillStyle(Style, MaxColor);
  6702.   with ViewInfo do
  6703.     Bar(X, Y, X+Width, Y+Height);
  6704.   Rectangle(X, Y, X+Width, Y+Height);
  6705.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  6706.   Inc(Style);
  6707. end; { DrawBox }
  6708.  
  6709. begin
  6710.   MainWindow('Pre-defined fill styles');
  6711.   GetViewSettings(ViewInfo);
  6712.   with ViewInfo do
  6713.   begin
  6714.     Width := 2 * ((x2+1) div 13);
  6715.     Height := 2 * ((y2-10) div 10);
  6716.   end;
  6717.   X := Width div 2;
  6718.   Y := Height div 2;
  6719.   Style := 0;
  6720.   for J := 1 to 3 do
  6721.   begin
  6722.     for I := 1 to 4 do
  6723.     begin
  6724.       DrawBox(X, Y);
  6725.       Inc(X, (Width div 2) * 3);
  6726.     end;
  6727.     X := Width div 2;
  6728.     Inc(Y, (Height div 2) * 3);
  6729.   end;
  6730.   SetTextJustify(LeftText, TopText);
  6731.   WaitToGo;
  6732. end; { FillStylePlay }
  6733.  
  6734. procedure FillPatternPlay;
  6735. { Display some user defined fill patterns }
  6736. const
  6737.   Patterns : array[0..11] of FillPatternType = (
  6738.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  6739.             OldColor which has a path of pixels of OldColor or NewColor
  6740.             with sides touching back to the seed point, (XSeed, YSeed).
  6741.             Therefore, only pixels of OldColor are modified and no other
  6742.             information is changed.
  6743.  
  6744.             SEE ALSO
  6745.  
  6746.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  6747.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  6748.             SETVIEW
  6749.  
  6750.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  6751.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  6752.             IF WHICHVGA = 0 THEN STOP
  6753.             DUMMY=RES640
  6754.             SETVIEW 100, 100, 539, 379
  6755.             FILLVIEW 10
  6756.             WHILE INKEY$ = ""
  6757.             WEND
  6758.             VIDEOMODESET VMODE
  6759.             END
  6760.  
  6761.  
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.                                                                          63
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.           FONTGETINFO
  6784.  
  6785.             PROTOTYPE
  6786.  
  6787.             SUB FONTGETINFO (Width%, Height%)
  6788.  
  6789.             INPUT
  6790.  
  6791.             no input parameters
  6792.     WEND
  6793.             MOUSEEXIT
  6794.             VIDEOMODESET VMODE
  6795.             END
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.  
  6810.  
  6811.  
  6812.  
  6813.  
  6814.  
  6815.  
  6816.  
  6817.  
  6818.  
  6819.  
  6820.  
  6821.  
  6822.  
  6823.  
  6824.  
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.                                                                          86
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.           MOUSECURSORDEFAULT
  6844.  
  6845.             PROTOTYPE
  6846.  
  6847.             SUB MOUSECURSORDEFAULT ()
  6848.  
  6849.             INPUT
  6850.  
  6851.             no input parameters
  6852.  
  6853.             OUTPUT
  6854.  
  6855.             no value returned
  6856.  
  6857.             USAGE
  6858.  
  6859.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  6860.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  6861. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  6862. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  6863. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  6864. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  6865. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  6866. $╤
  6867. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  6868. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  6869. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  6870. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  6871. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  6872. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  6873. ░£▒
  6874. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  6875. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  6876.       end;
  6877.     end;
  6878.   end;
  6879.   WaitToGo;
  6880. end; { UserLineStylePlay }
  6881.  
  6882.  
  6883. procedure SayGoodbye;
  6884. { Say goodbye and then exit the program }
  6885. var
  6886.   ViewInfo : ViewPortType;
  6887. begin
  6888.   MainWindow('');
  6889.   GetViewSettings(ViewInfo);
  6890.   SetTextStyle(TriplexFont, HorizDir, 4);
  6891.   SetTextJustify(CenterText, CenterText);
  6892.   with ViewInfo do
  6893.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  6894.   StatusLine('Press any key to quit...');
  6895.   repeat until KeyPressed;
  6896. end; { SayGoodbye }
  6897.  
  6898.  
  6899. PROCEDURE SelectMode;
  6900. VAR
  6901.     choice1,choice2     : CHAR;
  6902.    xsize,ysize            : WORD;
  6903. BEGIN
  6904.     (* Let's select a mode *)
  6905.     ClrScr;
  6906.     WriteLn('VESADEMO:');
  6907.     WriteLn('1. 256 colors');
  6908.     WriteLn('2. 32768 colors');
  6909.     WriteLn('3. 65536 colors');
  6910.     WriteLn('4. 16777216 colors');
  6911.     WriteLn('Q uit');
  6912.     WriteLn;
  6913.     Write('Your choice: ');
  6914.     REPEAT
  6915.         ReadLn(choice1);
  6916.       IF choice1 <> '1' THEN BEGIN
  6917.           WriteLn('Sorry !');
  6918.          WriteLn('This demo wasn''t written for more as 256 colors !');
  6919.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  6920.          WriteLn('Switching to 256 colors.');
  6921.          choice1 := '1';
  6922.       END;
  6923.     UNTIL choice1 IN ['1'..'4','q'];
  6924.     IF choice1 = 'q' THEN Halt;
  6925.  
  6926.     WriteLn;
  6927.     WriteLn;
  6928.     WriteLn('a. 320x200');
  6929.     WriteLn('b. 640x480');
  6930.     WriteLn('c. 800x600');
  6931.     WriteLn('d. 1024x768');
  6932.     WriteLn('e. 1280x1024');
  6933.     WriteLn('Q uit');
  6934.     WriteLn;
  6935.     Write('Your choice: ');
  6936.     REPEAT
  6937.         ReadLn(choice2);
  6938.     UNTIL choice2 IN ['a'..'e','q'];
  6939.     IF choice2 = 'q' THEN Halt;
  6940.  
  6941.     CASE choice2 OF
  6942.         'a' : BEGIN
  6943.             xsize := 320;
  6944.             ysize := 200;
  6945.         END;
  6946.         'b' : BEGIN
  6947.             xsize := 640;
  6948.             ysize := 480;
  6949.         END;
  6950.         'c' : BEGIN
  6951.             xsize := 800;
  6952.             ysize := 600;
  6953.         END;
  6954.         'd' : BEGIN
  6955.             xsize := 1024;
  6956.             ysize := 768;
  6957.         END;
  6958.         'e' : BEGIN
  6959.             xsize := 1280;
  6960.             ysize := 1024;
  6961.         END;
  6962.     END;
  6963.     CASE choice1 OF
  6964.         '1' : mode := FindVesaMode(xsize,ysize,8);
  6965.         '2' : mode := FindVesaMode(xsize,ysize,15);
  6966.         '3' : mode := FindVesaMode(xsize,ysize,16);
  6967.         '4' : mode := FindVesaMode(xsize,ysize,24);
  6968.     END;
  6969.     IF mode = 0 THEN BEGIN
  6970.         WriteLn('No such mode could be found !');
  6971.         WriteLn('Switching to to 320x200.');
  6972.         ReadKey;
  6973.         mode := V320x200x256;
  6974.     END;
  6975. END;
  6976.  
  6977. begin { program body }
  6978.   SelectMode;
  6979.   Initialize;
  6980.   ReportStatus;
  6981.  
  6982. {  AspectRatioPlay; }
  6983.   FillEllipsePlay;
  6984.   SectorPlay;
  6985.   WriteModePlay;
  6986.  
  6987.   ColorPlay;
  6988.   { PalettePlay only intended to work on these drivers: }
  6989.   if (GraphDriver = EGA) or
  6990.       (GraphDriver = EGA64) or
  6991.       (GraphDriver = VGA) then
  6992.      PalettePlay;
  6993.   PutPixelPlay;
  6994. {  PutImagePlay; }
  6995.   RandBarPlay;
  6996.   BarPlay;
  6997.   Bar3DPlay;
  6998.   ArcPlay;
  6999.   CirclePlay;
  7000.   PiePlay;
  7001.   LineToPlay;
  7002.   LineRelPlay;
  7003. {  LineStylePlay; }
  7004. {  UserLineStylePlay; }
  7005.   TextDump;
  7006.   TextPlay;
  7007.   CrtModePlay;
  7008.   FillStylePlay;
  7009.   FillPatternPlay;
  7010.   PolyPlay;
  7011.   SayGoodbye;
  7012. {  CloseGraph; }
  7013.   CloseVesa;
  7014. end.
  7015. ***************************************************
  7016.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  7017.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  7018. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  7019. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  7020. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  7021. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  7022.     Color := RandColor;
  7023.     SetColor(Color);
  7024.     SetFillStyle(Random(CloseDotFill)+1, Color);
  7025.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  7026.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  7027.   until KeyPressed;
  7028.   WaitToGo;
  7029. end; { RandBarPlay }
  7030.  
  7031. procedure ArcPlay;
  7032. { Draw random arcs on the screen }
  7033. var
  7034.   MaxRadius : word;
  7035.   EndAngle : word;
  7036.   ArcInfo : ArcCoordsType;
  7037. begin
  7038.   MainWindow('Arc / GetArcCoords demonstration');
  7039.   StatusLine('Esc aborts or press a key');
  7040.   MaxRadius := MaxY div 10;
  7041.   repeat
  7042.     SetColor(RandColor);
  7043.     EndAngle := Random(360);
  7044.     SetLineStyle(SolidLn, 0, NormWidth);
  7045.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  7046.     GetArcCoords(ArcInfo);
  7047.     with ArcInfo do
  7048.     begin
  7049.       Line(X, Y, XStart, YStart);
  7050.       Line(X, Y, Xend, Yend);
  7051.     end;
  7052.   until KeyPressed;
  7053.   WaitToGo;
  7054. end; { ArcPlay }
  7055.  
  7056. procedure PutPixelPlay;
  7057. { Demonstrate the PutPixel and GetPixel commands }
  7058. const
  7059.   Seed   = 1962; { A seed for the random number generator }
  7060.   NumPts = 2000; { The number of pixels plotted }
  7061.   Esc    = #27;
  7062. var
  7063.   I : word;
  7064.   X, Y, Color : word;
  7065.   XMax, YMax  : integer;
  7066.   ViewInfo    : ViewPortType;
  7067. begin
  7068.   MainWindow('PutPixel / GetPixel demonstration');
  7069.   StatusLine('Esc aborts or press a key...');
  7070.  
  7071.   GetViewSettings(ViewInfo);
  7072.   with ViewInfo do
  7073.   begin
  7074.     XMax := (x2-x1-1);
  7075.     YMax := (y2-y1-1);
  7076.   end;
  7077.  
  7078.   while not KeyPressed do
  7079.   begin
  7080.     { Plot random pixels }
  7081.     RandSeed := Seed;
  7082.     I := 0;
  7083.     while (not KeyPressed) and (I < NumPts) do
  7084.     begin
  7085.       Inc(I);
  7086.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  7087.     end;
  7088.  
  7089.     { Erase pixels }
  7090.     RandSeed := Seed;
  7091.     I := 0;
  7092.     while (not KeyPressed) and (I < NumPts) do
  7093.     begin
  7094.       Inc(I);
  7095.       X := Random(XMax)+1;
  7096.       Y := Random(YMax)+1;
  7097.       Color := GetPixel(X, Y);
  7098.         if Color = RandColor then
  7099.           PutPixel(X, Y, 0);
  7100.      end;
  7101.   end;
  7102.   WaitToGo;
  7103. end; { PutPixelPlay }
  7104.  
  7105. procedure PutImagePlay;
  7106. { Demonstrate the GetImage and PutImage commands }
  7107.  
  7108. const
  7109.   r  = 20;
  7110.   StartX = 100;
  7111.   StartY = 50;
  7112.  
  7113. var
  7114.   CurPort : ViewPortType;
  7115.  
  7116. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  7117. var
  7118.   Step : integer;
  7119. begin
  7120.   Step := Random(2*r);
  7121.   if Odd(Step) then
  7122.     Step := -Step;
  7123.   X := X + Step;
  7124.   Step := Random(r);
  7125.   if Odd(Step) then
  7126.     Step := -Step;
  7127.   Y := Y + Step;
  7128.  
  7129.   { Make saucer bounce off viewport walls }
  7130.   with CurPort do
  7131.   begin
  7132.     if (x1 + X + Width - 1 > x2) then
  7133.       X := x2-x1 - Width + 1
  7134.     else
  7135.       if (X < 0) then
  7136.         X := 0;
  7137.     if (y1 + Y + Height - 1 > y2) then
  7138.       Y := y2-y1 - Height + 1
  7139.     else
  7140.       if (Y < 0) then
  7141.         Y := 0;
  7142.   end;
  7143. end; { MoveSaucer }
  7144.  
  7145. var
  7146.   Pausetime : word;
  7147.   Saucer    : pointer;
  7148.   X, Y      : integer;
  7149.   ulx, uly  : word;
  7150.   lrx, lry  : word;
  7151.   Size      : word;
  7152.   I         : word;
  7153. begin
  7154.   ClearDevice;
  7155.   FullPort;
  7156.  
  7157.   { PaintScreen }
  7158.   ClearDevice;
  7159.   MainWindow('GetImage / PutImage Demonstration');
  7160.   StatusLine('Esc aborts or press a key...');
  7161.   GetViewSettings(CurPort);
  7162.  
  7163.   { DrawSaucer }
  7164.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  7165.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  7166.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  7167.   Circle(StartX+10, StartY-12, 2);
  7168.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  7169.   Circle(StartX-10, StartY-12, 2);
  7170.   SetFillStyle(SolidFill, MaxColor);
  7171.   FloodFill(StartX+1, StartY+4, GetColor);
  7172.  
  7173.   { ReadSaucerImage }
  7174.   ulx := StartX-(r+1);
  7175.   uly := StartY-14;
  7176.   lrx := StartX+(r+1);
  7177.   lry := StartY+(r div 3)+3;
  7178.  
  7179.   Size := ImageSize(ulx, uly, lrx, lry);
  7180.   GetMem(Saucer, Size);
  7181.   GetImage(ulx, uly, lrx, lry, Saucer^);
  7182. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  7183.  
  7184.   { Plot some "stars" }
  7185.   for I := 1 to 1000 do
  7186.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  7187.   X := MaxX div 2;
  7188.   Y := MaxY div 2;
  7189.   PauseTime := 70;
  7190.  
  7191.   { Move the saucer around }
  7192.   repeat
  7193. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  7194.      Delay(PauseTime);
  7195. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  7196.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  7197.   until KeyPressed;
  7198.   FreeMem(Saucer, size);
  7199.   WaitToGo;
  7200. end; { PutImagePlay }
  7201.  
  7202. procedure PolyPlay;
  7203. { Draw random polygons with random fill styles on the screen }
  7204. const
  7205.   MaxPts = 5;
  7206. type
  7207.   PolygonType = array[1..MaxPts] of PointType;
  7208. var
  7209.   Poly : PolygonType;
  7210.   I, Color : word;
  7211. begin
  7212.   MainWindow('FillPoly demonstration');
  7213.   StatusLine('Esc aborts or press a key...');
  7214.   repeat
  7215.     Color := RandColor;
  7216.     SetFillStyle(Random(11)+1, Color);
  7217.     SetColor(Color);
  7218.     for I := 1 to MaxPts do
  7219.       with Poly[I] do
  7220.       begin
  7221.         X := Random(MaxX);
  7222.         Y := Random(MaxY);
  7223.       end;
  7224.     FillPoly(MaxPts, Poly);
  7225.   until KeyPressed;
  7226.   WaitToGo;
  7227. end; { PolyPlay }
  7228.  
  7229. procedure FillStylePlay;
  7230. { Display all of the predefined fill styles available }
  7231. var
  7232.   Style    : word;
  7233.   Width    : word;
  7234.   Height   : word;
  7235.   X, Y     : word;
  7236.   I, J     : word;
  7237.   ViewInfo : ViewPortType;
  7238.  
  7239. procedure DrawBox(X, Y : word);
  7240. begin
  7241.   SetFillStyle(Style, MaxColor);
  7242.   with ViewInfo do
  7243.     Bar(X, Y, X+Width, Y+Height);
  7244.   Rectangle(X, Y, X+Width, Y+Height);
  7245.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  7246.   Inc(Style);
  7247. end; { DrawBox }
  7248.  
  7249. begin
  7250.   MainWindow('Pre-defined fill styles');
  7251.   GetViewSettings(ViewInfo);
  7252.   with ViewInfo do
  7253.   begin
  7254.     Width := 2 * ((x2+1) div 13);
  7255.     Height := 2 * ((y2-10) div 10);
  7256.   end;
  7257.   X := Width div 2;
  7258.   Y := Height div 2;
  7259.   Style := 0;
  7260.   for J := 1 to 3 do
  7261.   begin
  7262.     for I := 1 to 4 do
  7263.     begin
  7264.       DrawBox(X, Y);
  7265.       Inc(X, (Width div 2) * 3);
  7266.     end;
  7267.     X := Width div 2;
  7268.     Inc(Y, (Height div 2) * 3);
  7269.   end;
  7270.   SetTextJustify(LeftText, TopText);
  7271.   WaitToGo;
  7272. end; { FillStylePlay }
  7273.  
  7274. procedure FillPatternPlay;
  7275. { Display some user defined fill patterns }
  7276. const
  7277.   Patterns : array[0..11] of FillPatternType = (
  7278.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  7279.             OldColor which has a path of pixels of OldColor or NewColor
  7280.             with sides touching back to the seed point, (XSeed, YSeed).
  7281.             Therefore, only pixels of OldColor are modified and no other
  7282.             information is changed.
  7283.  
  7284.             SEE ALSO
  7285.  
  7286.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  7287.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  7288.             SETVIEW
  7289.  
  7290.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  7291.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  7292.             IF WHICHVGA = 0 THEN STOP
  7293.             DUMMY=RES640
  7294.             SETVIEW 100, 100, 539, 379
  7295.             FILLVIEW 10
  7296.             WHILE INKEY$ = ""
  7297.             WEND
  7298.             VIDEOMODESET VMODE
  7299.             END
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.  
  7316.                                                                          63
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.           FONTGETINFO
  7324.  
  7325.             PROTOTYPE
  7326.  
  7327.             SUB FONTGETINFO (Width%, Height%)
  7328.  
  7329.             INPUT
  7330.  
  7331.             no input parameters
  7332.     WEND
  7333.             MOUSEEXIT
  7334.             VIDEOMODESET VMODE
  7335.             END
  7336.  
  7337.  
  7338.  
  7339.  
  7340.  
  7341.  
  7342.  
  7343.  
  7344.  
  7345.  
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.                                                                          86
  7377.  
  7378.  
  7379.  
  7380.  
  7381.  
  7382.  
  7383.           MOUSECURSORDEFAULT
  7384.  
  7385.             PROTOTYPE
  7386.  
  7387.             SUB MOUSECURSORDEFAULT ()
  7388.  
  7389.             INPUT
  7390.  
  7391.             no input parameters
  7392.  
  7393.             OUTPUT
  7394.  
  7395.             no value returned
  7396.  
  7397.             USAGE
  7398.  
  7399.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  7400.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  7401. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  7402. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  7403. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  7404. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  7405. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  7406. $╤
  7407. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  7408. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  7409. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  7410. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  7411. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  7412. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  7413. ░£▒
  7414. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  7415. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  7416.       end;
  7417.     end;
  7418.   end;
  7419.   WaitToGo;
  7420. end; { UserLineStylePlay }
  7421.  
  7422.  
  7423. procedure SayGoodbye;
  7424. { Say goodbye and then exit the program }
  7425. var
  7426.   ViewInfo : ViewPortType;
  7427. begin
  7428.   MainWindow('');
  7429.   GetViewSettings(ViewInfo);
  7430.   SetTextStyle(TriplexFont, HorizDir, 4);
  7431.   SetTextJustify(CenterText, CenterText);
  7432.   with ViewInfo do
  7433.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  7434.   StatusLine('Press any key to quit...');
  7435.   repeat until KeyPressed;
  7436. end; { SayGoodbye }
  7437.  
  7438.  
  7439. PROCEDURE SelectMode;
  7440. VAR
  7441.     choice1,choice2     : CHAR;
  7442.    xsize,ysize            : WORD;
  7443. BEGIN
  7444.     (* Let's select a mode *)
  7445.     ClrScr;
  7446.     WriteLn('VESADEMO:');
  7447.     WriteLn('1. 256 colors');
  7448.     WriteLn('2. 32768 colors');
  7449.     WriteLn('3. 65536 colors');
  7450.     WriteLn('4. 16777216 colors');
  7451.     WriteLn('Q uit');
  7452.     WriteLn;
  7453.     Write('Your choice: ');
  7454.     REPEAT
  7455.         ReadLn(choice1);
  7456.       IF choice1 <> '1' THEN BEGIN
  7457.           WriteLn('Sorry !');
  7458.          WriteLn('This demo wasn''t written for more as 256 colors !');
  7459.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  7460.          WriteLn('Switching to 256 colors.');
  7461.          choice1 := '1';
  7462.       END;
  7463.     UNTIL choice1 IN ['1'..'4','q'];
  7464.     IF choice1 = 'q' THEN Halt;
  7465.  
  7466.     WriteLn;
  7467.     WriteLn;
  7468.     WriteLn('a. 320x200');
  7469.     WriteLn('b. 640x480');
  7470.     WriteLn('c. 800x600');
  7471.     WriteLn('d. 1024x768');
  7472.     WriteLn('e. 1280x1024');
  7473.     WriteLn('Q uit');
  7474.     WriteLn;
  7475.     Write('Your choice: ');
  7476.     REPEAT
  7477.         ReadLn(choice2);
  7478.     UNTIL choice2 IN ['a'..'e','q'];
  7479.     IF choice2 = 'q' THEN Halt;
  7480.  
  7481.     CASE choice2 OF
  7482.         'a' : BEGIN
  7483.             xsize := 320;
  7484.             ysize := 200;
  7485.         END;
  7486.         'b' : BEGIN
  7487.             xsize := 640;
  7488.             ysize := 480;
  7489.         END;
  7490.         'c' : BEGIN
  7491.             xsize := 800;
  7492.             ysize := 600;
  7493.         END;
  7494.         'd' : BEGIN
  7495.             xsize := 1024;
  7496.             ysize := 768;
  7497.         END;
  7498.         'e' : BEGIN
  7499.             xsize := 1280;
  7500.             ysize := 1024;
  7501.         END;
  7502.     END;
  7503.     CASE choice1 OF
  7504.         '1' : mode := FindVesaMode(xsize,ysize,8);
  7505.         '2' : mode := FindVesaMode(xsize,ysize,15);
  7506.         '3' : mode := FindVesaMode(xsize,ysize,16);
  7507.         '4' : mode := FindVesaMode(xsize,ysize,24);
  7508.     END;
  7509.     IF mode = 0 THEN BEGIN
  7510.         WriteLn('No such mode could be found !');
  7511.         WriteLn('Switching to to 320x200.');
  7512.         ReadKey;
  7513.         mode := V320x200x256;
  7514.     END;
  7515. END;
  7516.  
  7517. begin { program body }
  7518.   SelectMode;
  7519.   Initialize;
  7520.   ReportStatus;
  7521.  
  7522. {  AspectRatioPlay; }
  7523.   FillEllipsePlay;
  7524.   SectorPlay;
  7525.   WriteModePlay;
  7526.  
  7527.   ColorPlay;
  7528.   { PalettePlay only intended to work on these drivers: }
  7529.   if (GraphDriver = EGA) or
  7530.       (GraphDriver = EGA64) or
  7531.       (GraphDriver = VGA) then
  7532.      PalettePlay;
  7533.   PutPixelPlay;
  7534. {  PutImagePlay; }
  7535.   RandBarPlay;
  7536.   BarPlay;
  7537.   Bar3DPlay;
  7538.   ArcPlay;
  7539.   CirclePlay;
  7540.   PiePlay;
  7541.   LineToPlay;
  7542.   LineRelPlay;
  7543. {  LineStylePlay; }
  7544. {  UserLineStylePlay; }
  7545.   TextDump;
  7546.   TextPlay;
  7547.   CrtModePlay;
  7548.   FillStylePlay;
  7549.   FillPatternPlay;
  7550.   PolyPlay;
  7551.   SayGoodbye;
  7552. {  CloseGraph; }
  7553.   CloseVesa;
  7554. end.
  7555. ***************************************************
  7556.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  7557.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  7558. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  7559. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  7560. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  7561. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  7562.     Color := RandColor;
  7563.     SetColor(Color);
  7564.     SetFillStyle(Random(CloseDotFill)+1, Color);
  7565.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  7566.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  7567.   until KeyPressed;
  7568.   WaitToGo;
  7569. end; { RandBarPlay }
  7570.  
  7571. procedure ArcPlay;
  7572. { Draw random arcs on the screen }
  7573. var
  7574.   MaxRadius : word;
  7575.   EndAngle : word;
  7576.   ArcInfo : ArcCoordsType;
  7577. begin
  7578.   MainWindow('Arc / GetArcCoords demonstration');
  7579.   StatusLine('Esc aborts or press a key');
  7580.   MaxRadius := MaxY div 10;
  7581.   repeat
  7582.     SetColor(RandColor);
  7583.     EndAngle := Random(360);
  7584.     SetLineStyle(SolidLn, 0, NormWidth);
  7585.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  7586.     GetArcCoords(ArcInfo);
  7587.     with ArcInfo do
  7588.     begin
  7589.       Line(X, Y, XStart, YStart);
  7590.       Line(X, Y, Xend, Yend);
  7591.     end;
  7592.   until KeyPressed;
  7593.   WaitToGo;
  7594. end; { ArcPlay }
  7595.  
  7596. procedure PutPixelPlay;
  7597. { Demonstrate the PutPixel and GetPixel commands }
  7598. const
  7599.   Seed   = 1962; { A seed for the random number generator }
  7600.   NumPts = 2000; { The number of pixels plotted }
  7601.   Esc    = #27;
  7602. var
  7603.   I : word;
  7604.   X, Y, Color : word;
  7605.   XMax, YMax  : integer;
  7606.   ViewInfo    : ViewPortType;
  7607. begin
  7608.   MainWindow('PutPixel / GetPixel demonstration');
  7609.   StatusLine('Esc aborts or press a key...');
  7610.  
  7611.   GetViewSettings(ViewInfo);
  7612.   with ViewInfo do
  7613.   begin
  7614.     XMax := (x2-x1-1);
  7615.     YMax := (y2-y1-1);
  7616.   end;
  7617.  
  7618.   while not KeyPressed do
  7619.   begin
  7620.     { Plot random pixels }
  7621.     RandSeed := Seed;
  7622.     I := 0;
  7623.     while (not KeyPressed) and (I < NumPts) do
  7624.     begin
  7625.       Inc(I);
  7626.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  7627.     end;
  7628.  
  7629.     { Erase pixels }
  7630.     RandSeed := Seed;
  7631.     I := 0;
  7632.     while (not KeyPressed) and (I < NumPts) do
  7633.     begin
  7634.       Inc(I);
  7635.       X := Random(XMax)+1;
  7636.       Y := Random(YMax)+1;
  7637.       Color := GetPixel(X, Y);
  7638.         if Color = RandColor then
  7639.           PutPixel(X, Y, 0);
  7640.      end;
  7641.   end;
  7642.   WaitToGo;
  7643. end; { PutPixelPlay }
  7644.  
  7645. procedure PutImagePlay;
  7646. { Demonstrate the GetImage and PutImage commands }
  7647.  
  7648. const
  7649.   r  = 20;
  7650.   StartX = 100;
  7651.   StartY = 50;
  7652.  
  7653. var
  7654.   CurPort : ViewPortType;
  7655.  
  7656. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  7657. var
  7658.   Step : integer;
  7659. begin
  7660.   Step := Random(2*r);
  7661.   if Odd(Step) then
  7662.     Step := -Step;
  7663.   X := X + Step;
  7664.   Step := Random(r);
  7665.   if Odd(Step) then
  7666.     Step := -Step;
  7667.   Y := Y + Step;
  7668.  
  7669.   { Make saucer bounce off viewport walls }
  7670.   with CurPort do
  7671.   begin
  7672.     if (x1 + X + Width - 1 > x2) then
  7673.       X := x2-x1 - Width + 1
  7674.     else
  7675.       if (X < 0) then
  7676.         X := 0;
  7677.     if (y1 + Y + Height - 1 > y2) then
  7678.       Y := y2-y1 - Height + 1
  7679.     else
  7680.       if (Y < 0) then
  7681.         Y := 0;
  7682.   end;
  7683. end; { MoveSaucer }
  7684.  
  7685. var
  7686.   Pausetime : word;
  7687.   Saucer    : pointer;
  7688.   X, Y      : integer;
  7689.   ulx, uly  : word;
  7690.   lrx, lry  : word;
  7691.   Size      : word;
  7692.   I         : word;
  7693. begin
  7694.   ClearDevice;
  7695.   FullPort;
  7696.  
  7697.   { PaintScreen }
  7698.   ClearDevice;
  7699.   MainWindow('GetImage / PutImage Demonstration');
  7700.   StatusLine('Esc aborts or press a key...');
  7701.   GetViewSettings(CurPort);
  7702.  
  7703.   { DrawSaucer }
  7704.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  7705.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  7706.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  7707.   Circle(StartX+10, StartY-12, 2);
  7708.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  7709.   Circle(StartX-10, StartY-12, 2);
  7710.   SetFillStyle(SolidFill, MaxColor);
  7711.   FloodFill(StartX+1, StartY+4, GetColor);
  7712.  
  7713.   { ReadSaucerImage }
  7714.   ulx := StartX-(r+1);
  7715.   uly := StartY-14;
  7716.   lrx := StartX+(r+1);
  7717.   lry := StartY+(r div 3)+3;
  7718.  
  7719.   Size := ImageSize(ulx, uly, lrx, lry);
  7720.   GetMem(Saucer, Size);
  7721.   GetImage(ulx, uly, lrx, lry, Saucer^);
  7722. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  7723.  
  7724.   { Plot some "stars" }
  7725.   for I := 1 to 1000 do
  7726.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  7727.   X := MaxX div 2;
  7728.   Y := MaxY div 2;
  7729.   PauseTime := 70;
  7730.  
  7731.   { Move the saucer around }
  7732.   repeat
  7733. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  7734.      Delay(PauseTime);
  7735. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  7736.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  7737.   until KeyPressed;
  7738.   FreeMem(Saucer, size);
  7739.   WaitToGo;
  7740. end; { PutImagePlay }
  7741.  
  7742. procedure PolyPlay;
  7743. { Draw random polygons with random fill styles on the screen }
  7744. const
  7745.   MaxPts = 5;
  7746. type
  7747.   PolygonType = array[1..MaxPts] of PointType;
  7748. var
  7749.   Poly : PolygonType;
  7750.   I, Color : word;
  7751. begin
  7752.   MainWindow('FillPoly demonstration');
  7753.   StatusLine('Esc aborts or press a key...');
  7754.   repeat
  7755.     Color := RandColor;
  7756.     SetFillStyle(Random(11)+1, Color);
  7757.     SetColor(Color);
  7758.     for I := 1 to MaxPts do
  7759.       with Poly[I] do
  7760.       begin
  7761.         X := Random(MaxX);
  7762.         Y := Random(MaxY);
  7763.       end;
  7764.     FillPoly(MaxPts, Poly);
  7765.   until KeyPressed;
  7766.   WaitToGo;
  7767. end; { PolyPlay }
  7768.  
  7769. procedure FillStylePlay;
  7770. { Display all of the predefined fill styles available }
  7771. var
  7772.   Style    : word;
  7773.   Width    : word;
  7774.   Height   : word;
  7775.   X, Y     : word;
  7776.   I, J     : word;
  7777.   ViewInfo : ViewPortType;
  7778.  
  7779. procedure DrawBox(X, Y : word);
  7780. begin
  7781.   SetFillStyle(Style, MaxColor);
  7782.   with ViewInfo do
  7783.     Bar(X, Y, X+Width, Y+Height);
  7784.   Rectangle(X, Y, X+Width, Y+Height);
  7785.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  7786.   Inc(Style);
  7787. end; { DrawBox }
  7788.  
  7789. begin
  7790.   MainWindow('Pre-defined fill styles');
  7791.   GetViewSettings(ViewInfo);
  7792.   with ViewInfo do
  7793.   begin
  7794.     Width := 2 * ((x2+1) div 13);
  7795.     Height := 2 * ((y2-10) div 10);
  7796.   end;
  7797.   X := Width div 2;
  7798.   Y := Height div 2;
  7799.   Style := 0;
  7800.   for J := 1 to 3 do
  7801.   begin
  7802.     for I := 1 to 4 do
  7803.     begin
  7804.       DrawBox(X, Y);
  7805.       Inc(X, (Width div 2) * 3);
  7806.     end;
  7807.     X := Width div 2;
  7808.     Inc(Y, (Height div 2) * 3);
  7809.   end;
  7810.   SetTextJustify(LeftText, TopText);
  7811.   WaitToGo;
  7812. end; { FillStylePlay }
  7813.  
  7814. procedure FillPatternPlay;
  7815. { Display some user defined fill patterns }
  7816. const
  7817.   Patterns : array[0..11] of FillPatternType = (
  7818.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  7819.             OldColor which has a path of pixels of OldColor or NewColor
  7820.             with sides touching back to the seed point, (XSeed, YSeed).
  7821.             Therefore, only pixels of OldColor are modified and no other
  7822.             information is changed.
  7823.  
  7824.             SEE ALSO
  7825.  
  7826.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  7827.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  7828.             SETVIEW
  7829.  
  7830.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  7831.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  7832.             IF WHICHVGA = 0 THEN STOP
  7833.             DUMMY=RES640
  7834.             SETVIEW 100, 100, 539, 379
  7835.             FILLVIEW 10
  7836.             WHILE INKEY$ = ""
  7837.             WEND
  7838.             VIDEOMODESET VMODE
  7839.             END
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.  
  7855.  
  7856.                                                                          63
  7857.  
  7858.  
  7859.  
  7860.  
  7861.  
  7862.  
  7863.           FONTGETINFO
  7864.  
  7865.             PROTOTYPE
  7866.  
  7867.             SUB FONTGETINFO (Width%, Height%)
  7868.  
  7869.             INPUT
  7870.  
  7871.             no input parameters
  7872.     WEND
  7873.             MOUSEEXIT
  7874.             VIDEOMODESET VMODE
  7875.             END
  7876.  
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.  
  7886.  
  7887.  
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.  
  7914.  
  7915.  
  7916.                                                                          86
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.           MOUSECURSORDEFAULT
  7924.  
  7925.             PROTOTYPE
  7926.  
  7927.             SUB MOUSECURSORDEFAULT ()
  7928.  
  7929.             INPUT
  7930.  
  7931.             no input parameters
  7932.  
  7933.             OUTPUT
  7934.  
  7935.             no value returned
  7936.  
  7937.             USAGE
  7938.  
  7939.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  7940.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  7941. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  7942. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  7943. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  7944. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  7945. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  7946. $╤
  7947. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  7948. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  7949. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  7950. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  7951. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  7952. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  7953. ░£▒
  7954. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  7955. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  7956.       end;
  7957.     end;
  7958.   end;
  7959.   WaitToGo;
  7960. end; { UserLineStylePlay }
  7961.  
  7962.  
  7963. procedure SayGoodbye;
  7964. { Say goodbye and then exit the program }
  7965. var
  7966.   ViewInfo : ViewPortType;
  7967. begin
  7968.   MainWindow('');
  7969.   GetViewSettings(ViewInfo);
  7970.   SetTextStyle(TriplexFont, HorizDir, 4);
  7971.   SetTextJustify(CenterText, CenterText);
  7972.   with ViewInfo do
  7973.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  7974.   StatusLine('Press any key to quit...');
  7975.   repeat until KeyPressed;
  7976. end; { SayGoodbye }
  7977.  
  7978.  
  7979. PROCEDURE SelectMode;
  7980. VAR
  7981.     choice1,choice2     : CHAR;
  7982.    xsize,ysize            : WORD;
  7983. BEGIN
  7984.     (* Let's select a mode *)
  7985.     ClrScr;
  7986.     WriteLn('VESADEMO:');
  7987.     WriteLn('1. 256 colors');
  7988.     WriteLn('2. 32768 colors');
  7989.     WriteLn('3. 65536 colors');
  7990.     WriteLn('4. 16777216 colors');
  7991.     WriteLn('Q uit');
  7992.     WriteLn;
  7993.     Write('Your choice: ');
  7994.     REPEAT
  7995.         ReadLn(choice1);
  7996.       IF choice1 <> '1' THEN BEGIN
  7997.           WriteLn('Sorry !');
  7998.          WriteLn('This demo wasn''t written for more as 256 colors !');
  7999.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  8000.          WriteLn('Switching to 256 colors.');
  8001.          choice1 := '1';
  8002.       END;
  8003.     UNTIL choice1 IN ['1'..'4','q'];
  8004.     IF choice1 = 'q' THEN Halt;
  8005.  
  8006.     WriteLn;
  8007.     WriteLn;
  8008.     WriteLn('a. 320x200');
  8009.     WriteLn('b. 640x480');
  8010.     WriteLn('c. 800x600');
  8011.     WriteLn('d. 1024x768');
  8012.     WriteLn('e. 1280x1024');
  8013.     WriteLn('Q uit');
  8014.     WriteLn;
  8015.     Write('Your choice: ');
  8016.     REPEAT
  8017.         ReadLn(choice2);
  8018.     UNTIL choice2 IN ['a'..'e','q'];
  8019.     IF choice2 = 'q' THEN Halt;
  8020.  
  8021.     CASE choice2 OF
  8022.         'a' : BEGIN
  8023.             xsize := 320;
  8024.             ysize := 200;
  8025.         END;
  8026.         'b' : BEGIN
  8027.             xsize := 640;
  8028.             ysize := 480;
  8029.         END;
  8030.         'c' : BEGIN
  8031.             xsize := 800;
  8032.             ysize := 600;
  8033.         END;
  8034.         'd' : BEGIN
  8035.             xsize := 1024;
  8036.             ysize := 768;
  8037.         END;
  8038.         'e' : BEGIN
  8039.             xsize := 1280;
  8040.             ysize := 1024;
  8041.         END;
  8042.     END;
  8043.     CASE choice1 OF
  8044.         '1' : mode := FindVesaMode(xsize,ysize,8);
  8045.         '2' : mode := FindVesaMode(xsize,ysize,15);
  8046.         '3' : mode := FindVesaMode(xsize,ysize,16);
  8047.         '4' : mode := FindVesaMode(xsize,ysize,24);
  8048.     END;
  8049.     IF mode = 0 THEN BEGIN
  8050.         WriteLn('No such mode could be found !');
  8051.         WriteLn('Switching to to 320x200.');
  8052.         ReadKey;
  8053.         mode := V320x200x256;
  8054.     END;
  8055. END;
  8056.  
  8057. begin { program body }
  8058.   SelectMode;
  8059.   Initialize;
  8060.   ReportStatus;
  8061.  
  8062. {  AspectRatioPlay; }
  8063.   FillEllipsePlay;
  8064.   SectorPlay;
  8065.   WriteModePlay;
  8066.  
  8067.   ColorPlay;
  8068.   { PalettePlay only intended to work on these drivers: }
  8069.   if (GraphDriver = EGA) or
  8070.       (GraphDriver = EGA64) or
  8071.       (GraphDriver = VGA) then
  8072.      PalettePlay;
  8073.   PutPixelPlay;
  8074. {  PutImagePlay; }
  8075.   RandBarPlay;
  8076.   BarPlay;
  8077.   Bar3DPlay;
  8078.   ArcPlay;
  8079.   CirclePlay;
  8080.   PiePlay;
  8081.   LineToPlay;
  8082.   LineRelPlay;
  8083. {  LineStylePlay; }
  8084. {  UserLineStylePlay; }
  8085.   TextDump;
  8086.   TextPlay;
  8087.   CrtModePlay;
  8088.   FillStylePlay;
  8089.   FillPatternPlay;
  8090.   PolyPlay;
  8091.   SayGoodbye;
  8092. {  CloseGraph; }
  8093.   CloseVesa;
  8094. end.
  8095. ***************************************************
  8096.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  8097.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  8098. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  8099. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  8100. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  8101. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  8102.     Color := RandColor;
  8103.     SetColor(Color);
  8104.     SetFillStyle(Random(CloseDotFill)+1, Color);
  8105.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  8106.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  8107.   until KeyPressed;
  8108.   WaitToGo;
  8109. end; { RandBarPlay }
  8110.  
  8111. procedure ArcPlay;
  8112. { Draw random arcs on the screen }
  8113. var
  8114.   MaxRadius : word;
  8115.   EndAngle : word;
  8116.   ArcInfo : ArcCoordsType;
  8117. begin
  8118.   MainWindow('Arc / GetArcCoords demonstration');
  8119.   StatusLine('Esc aborts or press a key');
  8120.   MaxRadius := MaxY div 10;
  8121.   repeat
  8122.     SetColor(RandColor);
  8123.     EndAngle := Random(360);
  8124.     SetLineStyle(SolidLn, 0, NormWidth);
  8125.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  8126.     GetArcCoords(ArcInfo);
  8127.     with ArcInfo do
  8128.     begin
  8129.       Line(X, Y, XStart, YStart);
  8130.       Line(X, Y, Xend, Yend);
  8131.     end;
  8132.   until KeyPressed;
  8133.   WaitToGo;
  8134. end; { ArcPlay }
  8135.  
  8136. procedure PutPixelPlay;
  8137. { Demonstrate the PutPixel and GetPixel commands }
  8138. const
  8139.   Seed   = 1962; { A seed for the random number generator }
  8140.   NumPts = 2000; { The number of pixels plotted }
  8141.   Esc    = #27;
  8142. var
  8143.   I : word;
  8144.   X, Y, Color : word;
  8145.   XMax, YMax  : integer;
  8146.   ViewInfo    : ViewPortType;
  8147. begin
  8148.   MainWindow('PutPixel / GetPixel demonstration');
  8149.   StatusLine('Esc aborts or press a key...');
  8150.  
  8151.   GetViewSettings(ViewInfo);
  8152.   with ViewInfo do
  8153.   begin
  8154.     XMax := (x2-x1-1);
  8155.     YMax := (y2-y1-1);
  8156.   end;
  8157.  
  8158.   while not KeyPressed do
  8159.   begin
  8160.     { Plot random pixels }
  8161.     RandSeed := Seed;
  8162.     I := 0;
  8163.     while (not KeyPressed) and (I < NumPts) do
  8164.     begin
  8165.       Inc(I);
  8166.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  8167.     end;
  8168.  
  8169.     { Erase pixels }
  8170.     RandSeed := Seed;
  8171.     I := 0;
  8172.     while (not KeyPressed) and (I < NumPts) do
  8173.     begin
  8174.       Inc(I);
  8175.       X := Random(XMax)+1;
  8176.       Y := Random(YMax)+1;
  8177.       Color := GetPixel(X, Y);
  8178.         if Color = RandColor then
  8179.           PutPixel(X, Y, 0);
  8180.      end;
  8181.   end;
  8182.   WaitToGo;
  8183. end; { PutPixelPlay }
  8184.  
  8185. procedure PutImagePlay;
  8186. { Demonstrate the GetImage and PutImage commands }
  8187.  
  8188. const
  8189.   r  = 20;
  8190.   StartX = 100;
  8191.   StartY = 50;
  8192.  
  8193. var
  8194.   CurPort : ViewPortType;
  8195.  
  8196. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  8197. var
  8198.   Step : integer;
  8199. begin
  8200.   Step := Random(2*r);
  8201.   if Odd(Step) then
  8202.     Step := -Step;
  8203.   X := X + Step;
  8204.   Step := Random(r);
  8205.   if Odd(Step) then
  8206.     Step := -Step;
  8207.   Y := Y + Step;
  8208.  
  8209.   { Make saucer bounce off viewport walls }
  8210.   with CurPort do
  8211.   begin
  8212.     if (x1 + X + Width - 1 > x2) then
  8213.       X := x2-x1 - Width + 1
  8214.     else
  8215.       if (X < 0) then
  8216.         X := 0;
  8217.     if (y1 + Y + Height - 1 > y2) then
  8218.       Y := y2-y1 - Height + 1
  8219.     else
  8220.       if (Y < 0) then
  8221.         Y := 0;
  8222.   end;
  8223. end; { MoveSaucer }
  8224.  
  8225. var
  8226.   Pausetime : word;
  8227.   Saucer    : pointer;
  8228.   X, Y      : integer;
  8229.   ulx, uly  : word;
  8230.   lrx, lry  : word;
  8231.   Size      : word;
  8232.   I         : word;
  8233. begin
  8234.   ClearDevice;
  8235.   FullPort;
  8236.  
  8237.   { PaintScreen }
  8238.   ClearDevice;
  8239.   MainWindow('GetImage / PutImage Demonstration');
  8240.   StatusLine('Esc aborts or press a key...');
  8241.   GetViewSettings(CurPort);
  8242.  
  8243.   { DrawSaucer }
  8244.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  8245.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  8246.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  8247.   Circle(StartX+10, StartY-12, 2);
  8248.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  8249.   Circle(StartX-10, StartY-12, 2);
  8250.   SetFillStyle(SolidFill, MaxColor);
  8251.   FloodFill(StartX+1, StartY+4, GetColor);
  8252.  
  8253.   { ReadSaucerImage }
  8254.   ulx := StartX-(r+1);
  8255.   uly := StartY-14;
  8256.   lrx := StartX+(r+1);
  8257.   lry := StartY+(r div 3)+3;
  8258.  
  8259.   Size := ImageSize(ulx, uly, lrx, lry);
  8260.   GetMem(Saucer, Size);
  8261.   GetImage(ulx, uly, lrx, lry, Saucer^);
  8262. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  8263.  
  8264.   { Plot some "stars" }
  8265.   for I := 1 to 1000 do
  8266.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  8267.   X := MaxX div 2;
  8268.   Y := MaxY div 2;
  8269.   PauseTime := 70;
  8270.  
  8271.   { Move the saucer around }
  8272.   repeat
  8273. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  8274.      Delay(PauseTime);
  8275. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  8276.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  8277.   until KeyPressed;
  8278.   FreeMem(Saucer, size);
  8279.   WaitToGo;
  8280. end; { PutImagePlay }
  8281.  
  8282. procedure PolyPlay;
  8283. { Draw random polygons with random fill styles on the screen }
  8284. const
  8285.   MaxPts = 5;
  8286. type
  8287.   PolygonType = array[1..MaxPts] of PointType;
  8288. var
  8289.   Poly : PolygonType;
  8290.   I, Color : word;
  8291. begin
  8292.   MainWindow('FillPoly demonstration');
  8293.   StatusLine('Esc aborts or press a key...');
  8294.   repeat
  8295.     Color := RandColor;
  8296.     SetFillStyle(Random(11)+1, Color);
  8297.     SetColor(Color);
  8298.     for I := 1 to MaxPts do
  8299.       with Poly[I] do
  8300.       begin
  8301.         X := Random(MaxX);
  8302.         Y := Random(MaxY);
  8303.       end;
  8304.     FillPoly(MaxPts, Poly);
  8305.   until KeyPressed;
  8306.   WaitToGo;
  8307. end; { PolyPlay }
  8308.  
  8309. procedure FillStylePlay;
  8310. { Display all of the predefined fill styles available }
  8311. var
  8312.   Style    : word;
  8313.   Width    : word;
  8314.   Height   : word;
  8315.   X, Y     : word;
  8316.   I, J     : word;
  8317.   ViewInfo : ViewPortType;
  8318.  
  8319. procedure DrawBox(X, Y : word);
  8320. begin
  8321.   SetFillStyle(Style, MaxColor);
  8322.   with ViewInfo do
  8323.     Bar(X, Y, X+Width, Y+Height);
  8324.   Rectangle(X, Y, X+Width, Y+Height);
  8325.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  8326.   Inc(Style);
  8327. end; { DrawBox }
  8328.  
  8329. begin
  8330.   MainWindow('Pre-defined fill styles');
  8331.   GetViewSettings(ViewInfo);
  8332.   with ViewInfo do
  8333.   begin
  8334.     Width := 2 * ((x2+1) div 13);
  8335.     Height := 2 * ((y2-10) div 10);
  8336.   end;
  8337.   X := Width div 2;
  8338.   Y := Height div 2;
  8339.   Style := 0;
  8340.   for J := 1 to 3 do
  8341.   begin
  8342.     for I := 1 to 4 do
  8343.     begin
  8344.       DrawBox(X, Y);
  8345.       Inc(X, (Width div 2) * 3);
  8346.     end;
  8347.     X := Width div 2;
  8348.     Inc(Y, (Height div 2) * 3);
  8349.   end;
  8350.   SetTextJustify(LeftText, TopText);
  8351.   WaitToGo;
  8352. end; { FillStylePlay }
  8353.  
  8354. procedure FillPatternPlay;
  8355. { Display some user defined fill patterns }
  8356. const
  8357.   Patterns : array[0..11] of FillPatternType = (
  8358.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  8359.             OldColor which has a path of pixels of OldColor or NewColor
  8360.             with sides touching back to the seed point, (XSeed, YSeed).
  8361.             Therefore, only pixels of OldColor are modified and no other
  8362.             information is changed.
  8363.  
  8364.             SEE ALSO
  8365.  
  8366.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  8367.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  8368.             SETVIEW
  8369.  
  8370.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  8371.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  8372.             IF WHICHVGA = 0 THEN STOP
  8373.             DUMMY=RES640
  8374.             SETVIEW 100, 100, 539, 379
  8375.             FILLVIEW 10
  8376.             WHILE INKEY$ = ""
  8377.             WEND
  8378.             VIDEOMODESET VMODE
  8379.             END
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.                                                                          63
  8397.  
  8398.  
  8399.  
  8400.  
  8401.  
  8402.  
  8403.           FONTGETINFO
  8404.  
  8405.             PROTOTYPE
  8406.  
  8407.             SUB FONTGETINFO (Width%, Height%)
  8408.  
  8409.             INPUT
  8410.  
  8411.             no input parameters
  8412.     WEND
  8413.             MOUSEEXIT
  8414.             VIDEOMODESET VMODE
  8415.             END
  8416.  
  8417.  
  8418.  
  8419.  
  8420.  
  8421.  
  8422.  
  8423.  
  8424.  
  8425.  
  8426.  
  8427.  
  8428.  
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.  
  8437.  
  8438.  
  8439.  
  8440.  
  8441.  
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.  
  8455.  
  8456.                                                                          86
  8457.  
  8458.  
  8459.  
  8460.  
  8461.  
  8462.  
  8463.           MOUSECURSORDEFAULT
  8464.  
  8465.             PROTOTYPE
  8466.  
  8467.             SUB MOUSECURSORDEFAULT ()
  8468.  
  8469.             INPUT
  8470.  
  8471.             no input parameters
  8472.  
  8473.             OUTPUT
  8474.  
  8475.             no value returned
  8476.  
  8477.             USAGE
  8478.  
  8479.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  8480.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  8481. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  8482. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  8483. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  8484. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  8485. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  8486. $╤
  8487. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  8488. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  8489. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  8490. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  8491. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  8492. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  8493. ░£▒
  8494. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  8495. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  8496.       end;
  8497.     end;
  8498.   end;
  8499.   WaitToGo;
  8500. end; { UserLineStylePlay }
  8501.  
  8502.  
  8503. procedure SayGoodbye;
  8504. { Say goodbye and then exit the program }
  8505. var
  8506.   ViewInfo : ViewPortType;
  8507. begin
  8508.   MainWindow('');
  8509.   GetViewSettings(ViewInfo);
  8510.   SetTextStyle(TriplexFont, HorizDir, 4);
  8511.   SetTextJustify(CenterText, CenterText);
  8512.   with ViewInfo do
  8513.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  8514.   StatusLine('Press any key to quit...');
  8515.   repeat until KeyPressed;
  8516. end; { SayGoodbye }
  8517.  
  8518.  
  8519. PROCEDURE SelectMode;
  8520. VAR
  8521.     choice1,choice2     : CHAR;
  8522.    xsize,ysize            : WORD;
  8523. BEGIN
  8524.     (* Let's select a mode *)
  8525.     ClrScr;
  8526.     WriteLn('VESADEMO:');
  8527.     WriteLn('1. 256 colors');
  8528.     WriteLn('2. 32768 colors');
  8529.     WriteLn('3. 65536 colors');
  8530.     WriteLn('4. 16777216 colors');
  8531.     WriteLn('Q uit');
  8532.     WriteLn;
  8533.     Write('Your choice: ');
  8534.     REPEAT
  8535.         ReadLn(choice1);
  8536.       IF choice1 <> '1' THEN BEGIN
  8537.           WriteLn('Sorry !');
  8538.          WriteLn('This demo wasn''t written for more as 256 colors !');
  8539.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  8540.          WriteLn('Switching to 256 colors.');
  8541.          choice1 := '1';
  8542.       END;
  8543.     UNTIL choice1 IN ['1'..'4','q'];
  8544.     IF choice1 = 'q' THEN Halt;
  8545.  
  8546.     WriteLn;
  8547.     WriteLn;
  8548.     WriteLn('a. 320x200');
  8549.     WriteLn('b. 640x480');
  8550.     WriteLn('c. 800x600');
  8551.     WriteLn('d. 1024x768');
  8552.     WriteLn('e. 1280x1024');
  8553.     WriteLn('Q uit');
  8554.     WriteLn;
  8555.     Write('Your choice: ');
  8556.     REPEAT
  8557.         ReadLn(choice2);
  8558.     UNTIL choice2 IN ['a'..'e','q'];
  8559.     IF choice2 = 'q' THEN Halt;
  8560.  
  8561.     CASE choice2 OF
  8562.         'a' : BEGIN
  8563.             xsize := 320;
  8564.             ysize := 200;
  8565.         END;
  8566.         'b' : BEGIN
  8567.             xsize := 640;
  8568.             ysize := 480;
  8569.         END;
  8570.         'c' : BEGIN
  8571.             xsize := 800;
  8572.             ysize := 600;
  8573.         END;
  8574.         'd' : BEGIN
  8575.             xsize := 1024;
  8576.             ysize := 768;
  8577.         END;
  8578.         'e' : BEGIN
  8579.             xsize := 1280;
  8580.             ysize := 1024;
  8581.         END;
  8582.     END;
  8583.     CASE choice1 OF
  8584.         '1' : mode := FindVesaMode(xsize,ysize,8);
  8585.         '2' : mode := FindVesaMode(xsize,ysize,15);
  8586.         '3' : mode := FindVesaMode(xsize,ysize,16);
  8587.         '4' : mode := FindVesaMode(xsize,ysize,24);
  8588.     END;
  8589.     IF mode = 0 THEN BEGIN
  8590.         WriteLn('No such mode could be found !');
  8591.         WriteLn('Switching to to 320x200.');
  8592.         ReadKey;
  8593.         mode := V320x200x256;
  8594.     END;
  8595. END;
  8596.  
  8597. begin { program body }
  8598.   SelectMode;
  8599.   Initialize;
  8600.   ReportStatus;
  8601.  
  8602. {  AspectRatioPlay; }
  8603.   FillEllipsePlay;
  8604.   SectorPlay;
  8605.   WriteModePlay;
  8606.  
  8607.   ColorPlay;
  8608.   { PalettePlay only intended to work on these drivers: }
  8609.   if (GraphDriver = EGA) or
  8610.       (GraphDriver = EGA64) or
  8611.       (GraphDriver = VGA) then
  8612.      PalettePlay;
  8613.   PutPixelPlay;
  8614. {  PutImagePlay; }
  8615.   RandBarPlay;
  8616.   BarPlay;
  8617.   Bar3DPlay;
  8618.   ArcPlay;
  8619.   CirclePlay;
  8620.   PiePlay;
  8621.   LineToPlay;
  8622.   LineRelPlay;
  8623. {  LineStylePlay; }
  8624. {  UserLineStylePlay; }
  8625.   TextDump;
  8626.   TextPlay;
  8627.   CrtModePlay;
  8628.   FillStylePlay;
  8629.   FillPatternPlay;
  8630.   PolyPlay;
  8631.   SayGoodbye;
  8632. {  CloseGraph; }
  8633.   CloseVesa;
  8634. end.
  8635. ***************************************************
  8636.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  8637.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  8638. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  8639. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  8640. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  8641. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  8642.     Color := RandColor;
  8643.     SetColor(Color);
  8644.     SetFillStyle(Random(CloseDotFill)+1, Color);
  8645.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  8646.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  8647.   until KeyPressed;
  8648.   WaitToGo;
  8649. end; { RandBarPlay }
  8650.  
  8651. procedure ArcPlay;
  8652. { Draw random arcs on the screen }
  8653. var
  8654.   MaxRadius : word;
  8655.   EndAngle : word;
  8656.   ArcInfo : ArcCoordsType;
  8657. begin
  8658.   MainWindow('Arc / GetArcCoords demonstration');
  8659.   StatusLine('Esc aborts or press a key');
  8660.   MaxRadius := MaxY div 10;
  8661.   repeat
  8662.     SetColor(RandColor);
  8663.     EndAngle := Random(360);
  8664.     SetLineStyle(SolidLn, 0, NormWidth);
  8665.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  8666.     GetArcCoords(ArcInfo);
  8667.     with ArcInfo do
  8668.     begin
  8669.       Line(X, Y, XStart, YStart);
  8670.       Line(X, Y, Xend, Yend);
  8671.     end;
  8672.   until KeyPressed;
  8673.   WaitToGo;
  8674. end; { ArcPlay }
  8675.  
  8676. procedure PutPixelPlay;
  8677. { Demonstrate the PutPixel and GetPixel commands }
  8678. const
  8679.   Seed   = 1962; { A seed for the random number generator }
  8680.   NumPts = 2000; { The number of pixels plotted }
  8681.   Esc    = #27;
  8682. var
  8683.   I : word;
  8684.   X, Y, Color : word;
  8685.   XMax, YMax  : integer;
  8686.   ViewInfo    : ViewPortType;
  8687. begin
  8688.   MainWindow('PutPixel / GetPixel demonstration');
  8689.   StatusLine('Esc aborts or press a key...');
  8690.  
  8691.   GetViewSettings(ViewInfo);
  8692.   with ViewInfo do
  8693.   begin
  8694.     XMax := (x2-x1-1);
  8695.     YMax := (y2-y1-1);
  8696.   end;
  8697.  
  8698.   while not KeyPressed do
  8699.   begin
  8700.     { Plot random pixels }
  8701.     RandSeed := Seed;
  8702.     I := 0;
  8703.     while (not KeyPressed) and (I < NumPts) do
  8704.     begin
  8705.       Inc(I);
  8706.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  8707.     end;
  8708.  
  8709.     { Erase pixels }
  8710.     RandSeed := Seed;
  8711.     I := 0;
  8712.     while (not KeyPressed) and (I < NumPts) do
  8713.     begin
  8714.       Inc(I);
  8715.       X := Random(XMax)+1;
  8716.       Y := Random(YMax)+1;
  8717.       Color := GetPixel(X, Y);
  8718.         if Color = RandColor then
  8719.           PutPixel(X, Y, 0);
  8720.      end;
  8721.   end;
  8722.   WaitToGo;
  8723. end; { PutPixelPlay }
  8724.  
  8725. procedure PutImagePlay;
  8726. { Demonstrate the GetImage and PutImage commands }
  8727.  
  8728. const
  8729.   r  = 20;
  8730.   StartX = 100;
  8731.   StartY = 50;
  8732.  
  8733. var
  8734.   CurPort : ViewPortType;
  8735.  
  8736. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  8737. var
  8738.   Step : integer;
  8739. begin
  8740.   Step := Random(2*r);
  8741.   if Odd(Step) then
  8742.     Step := -Step;
  8743.   X := X + Step;
  8744.   Step := Random(r);
  8745.   if Odd(Step) then
  8746.     Step := -Step;
  8747.   Y := Y + Step;
  8748.  
  8749.   { Make saucer bounce off viewport walls }
  8750.   with CurPort do
  8751.   begin
  8752.     if (x1 + X + Width - 1 > x2) then
  8753.       X := x2-x1 - Width + 1
  8754.     else
  8755.       if (X < 0) then
  8756.         X := 0;
  8757.     if (y1 + Y + Height - 1 > y2) then
  8758.       Y := y2-y1 - Height + 1
  8759.     else
  8760.       if (Y < 0) then
  8761.         Y := 0;
  8762.   end;
  8763. end; { MoveSaucer }
  8764.  
  8765. var
  8766.   Pausetime : word;
  8767.   Saucer    : pointer;
  8768.   X, Y      : integer;
  8769.   ulx, uly  : word;
  8770.   lrx, lry  : word;
  8771.   Size      : word;
  8772.   I         : word;
  8773. begin
  8774.   ClearDevice;
  8775.   FullPort;
  8776.  
  8777.   { PaintScreen }
  8778.   ClearDevice;
  8779.   MainWindow('GetImage / PutImage Demonstration');
  8780.   StatusLine('Esc aborts or press a key...');
  8781.   GetViewSettings(CurPort);
  8782.  
  8783.   { DrawSaucer }
  8784.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  8785.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  8786.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  8787.   Circle(StartX+10, StartY-12, 2);
  8788.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  8789.   Circle(StartX-10, StartY-12, 2);
  8790.   SetFillStyle(SolidFill, MaxColor);
  8791.   FloodFill(StartX+1, StartY+4, GetColor);
  8792.  
  8793.   { ReadSaucerImage }
  8794.   ulx := StartX-(r+1);
  8795.   uly := StartY-14;
  8796.   lrx := StartX+(r+1);
  8797.   lry := StartY+(r div 3)+3;
  8798.  
  8799.   Size := ImageSize(ulx, uly, lrx, lry);
  8800.   GetMem(Saucer, Size);
  8801.   GetImage(ulx, uly, lrx, lry, Saucer^);
  8802. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  8803.  
  8804.   { Plot some "stars" }
  8805.   for I := 1 to 1000 do
  8806.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  8807.   X := MaxX div 2;
  8808.   Y := MaxY div 2;
  8809.   PauseTime := 70;
  8810.  
  8811.   { Move the saucer around }
  8812.   repeat
  8813. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  8814.      Delay(PauseTime);
  8815. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  8816.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  8817.   until KeyPressed;
  8818.   FreeMem(Saucer, size);
  8819.   WaitToGo;
  8820. end; { PutImagePlay }
  8821.  
  8822. procedure PolyPlay;
  8823. { Draw random polygons with random fill styles on the screen }
  8824. const
  8825.   MaxPts = 5;
  8826. type
  8827.   PolygonType = array[1..MaxPts] of PointType;
  8828. var
  8829.   Poly : PolygonType;
  8830.   I, Color : word;
  8831. begin
  8832.   MainWindow('FillPoly demonstration');
  8833.   StatusLine('Esc aborts or press a key...');
  8834.   repeat
  8835.     Color := RandColor;
  8836.     SetFillStyle(Random(11)+1, Color);
  8837.     SetColor(Color);
  8838.     for I := 1 to MaxPts do
  8839.       with Poly[I] do
  8840.       begin
  8841.         X := Random(MaxX);
  8842.         Y := Random(MaxY);
  8843.       end;
  8844.     FillPoly(MaxPts, Poly);
  8845.   until KeyPressed;
  8846.   WaitToGo;
  8847. end; { PolyPlay }
  8848.  
  8849. procedure FillStylePlay;
  8850. { Display all of the predefined fill styles available }
  8851. var
  8852.   Style    : word;
  8853.   Width    : word;
  8854.   Height   : word;
  8855.   X, Y     : word;
  8856.   I, J     : word;
  8857.   ViewInfo : ViewPortType;
  8858.  
  8859. procedure DrawBox(X, Y : word);
  8860. begin
  8861.   SetFillStyle(Style, MaxColor);
  8862.   with ViewInfo do
  8863.     Bar(X, Y, X+Width, Y+Height);
  8864.   Rectangle(X, Y, X+Width, Y+Height);
  8865.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  8866.   Inc(Style);
  8867. end; { DrawBox }
  8868.  
  8869. begin
  8870.   MainWindow('Pre-defined fill styles');
  8871.   GetViewSettings(ViewInfo);
  8872.   with ViewInfo do
  8873.   begin
  8874.     Width := 2 * ((x2+1) div 13);
  8875.     Height := 2 * ((y2-10) div 10);
  8876.   end;
  8877.   X := Width div 2;
  8878.   Y := Height div 2;
  8879.   Style := 0;
  8880.   for J := 1 to 3 do
  8881.   begin
  8882.     for I := 1 to 4 do
  8883.     begin
  8884.       DrawBox(X, Y);
  8885.       Inc(X, (Width div 2) * 3);
  8886.     end;
  8887.     X := Width div 2;
  8888.     Inc(Y, (Height div 2) * 3);
  8889.   end;
  8890.   SetTextJustify(LeftText, TopText);
  8891.   WaitToGo;
  8892. end; { FillStylePlay }
  8893.  
  8894. procedure FillPatternPlay;
  8895. { Display some user defined fill patterns }
  8896. const
  8897.   Patterns : array[0..11] of FillPatternType = (
  8898.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  8899.             OldColor which has a path of pixels of OldColor or NewColor
  8900.             with sides touching back to the seed point, (XSeed, YSeed).
  8901.             Therefore, only pixels of OldColor are modified and no other
  8902.             information is changed.
  8903.  
  8904.             SEE ALSO
  8905.  
  8906.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  8907.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  8908.             SETVIEW
  8909.  
  8910.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  8911.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  8912.             IF WHICHVGA = 0 THEN STOP
  8913.             DUMMY=RES640
  8914.             SETVIEW 100, 100, 539, 379
  8915.             FILLVIEW 10
  8916.             WHILE INKEY$ = ""
  8917.             WEND
  8918.             VIDEOMODESET VMODE
  8919.             END
  8920.  
  8921.  
  8922.  
  8923.  
  8924.  
  8925.  
  8926.  
  8927.  
  8928.  
  8929.  
  8930.  
  8931.  
  8932.  
  8933.  
  8934.  
  8935.  
  8936.                                                                          63
  8937.  
  8938.  
  8939.  
  8940.  
  8941.  
  8942.  
  8943.           FONTGETINFO
  8944.  
  8945.             PROTOTYPE
  8946.  
  8947.             SUB FONTGETINFO (Width%, Height%)
  8948.  
  8949.             INPUT
  8950.  
  8951.             no input parameters
  8952.     WEND
  8953.             MOUSEEXIT
  8954.             VIDEOMODESET VMODE
  8955.             END
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.  
  8968.  
  8969.  
  8970.  
  8971.  
  8972.  
  8973.  
  8974.  
  8975.  
  8976.  
  8977.  
  8978.  
  8979.  
  8980.  
  8981.  
  8982.  
  8983.  
  8984.  
  8985.  
  8986.  
  8987.  
  8988.  
  8989.  
  8990.  
  8991.  
  8992.  
  8993.  
  8994.  
  8995.  
  8996.                                                                          86
  8997.  
  8998.  
  8999.  
  9000.  
  9001.  
  9002.  
  9003.           MOUSECURSORDEFAULT
  9004.  
  9005.             PROTOTYPE
  9006.  
  9007.             SUB MOUSECURSORDEFAULT ()
  9008.  
  9009.             INPUT
  9010.  
  9011.             no input parameters
  9012.  
  9013.             OUTPUT
  9014.  
  9015.             no value returned
  9016.  
  9017.             USAGE
  9018.  
  9019.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  9020.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  9021. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  9022. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  9023. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  9024. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  9025. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  9026. $╤
  9027. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  9028. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  9029. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  9030. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  9031. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  9032. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  9033. ░£▒
  9034. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  9035. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  9036.       end;
  9037.     end;
  9038.   end;
  9039.   WaitToGo;
  9040. end; { UserLineStylePlay }
  9041.  
  9042.  
  9043. procedure SayGoodbye;
  9044. { Say goodbye and then exit the program }
  9045. var
  9046.   ViewInfo : ViewPortType;
  9047. begin
  9048.   MainWindow('');
  9049.   GetViewSettings(ViewInfo);
  9050.   SetTextStyle(TriplexFont, HorizDir, 4);
  9051.   SetTextJustify(CenterText, CenterText);
  9052.   with ViewInfo do
  9053.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  9054.   StatusLine('Press any key to quit...');
  9055.   repeat until KeyPressed;
  9056. end; { SayGoodbye }
  9057.  
  9058.  
  9059. PROCEDURE SelectMode;
  9060. VAR
  9061.     choice1,choice2     : CHAR;
  9062.    xsize,ysize            : WORD;
  9063. BEGIN
  9064.     (* Let's select a mode *)
  9065.     ClrScr;
  9066.     WriteLn('VESADEMO:');
  9067.     WriteLn('1. 256 colors');
  9068.     WriteLn('2. 32768 colors');
  9069.     WriteLn('3. 65536 colors');
  9070.     WriteLn('4. 16777216 colors');
  9071.     WriteLn('Q uit');
  9072.     WriteLn;
  9073.     Write('Your choice: ');
  9074.     REPEAT
  9075.         ReadLn(choice1);
  9076.       IF choice1 <> '1' THEN BEGIN
  9077.           WriteLn('Sorry !');
  9078.          WriteLn('This demo wasn''t written for more as 256 colors !');
  9079.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  9080.          WriteLn('Switching to 256 colors.');
  9081.          choice1 := '1';
  9082.       END;
  9083.     UNTIL choice1 IN ['1'..'4','q'];
  9084.     IF choice1 = 'q' THEN Halt;
  9085.  
  9086.     WriteLn;
  9087.     WriteLn;
  9088.     WriteLn('a. 320x200');
  9089.     WriteLn('b. 640x480');
  9090.     WriteLn('c. 800x600');
  9091.     WriteLn('d. 1024x768');
  9092.     WriteLn('e. 1280x1024');
  9093.     WriteLn('Q uit');
  9094.     WriteLn;
  9095.     Write('Your choice: ');
  9096.     REPEAT
  9097.         ReadLn(choice2);
  9098.     UNTIL choice2 IN ['a'..'e','q'];
  9099.     IF choice2 = 'q' THEN Halt;
  9100.  
  9101.     CASE choice2 OF
  9102.         'a' : BEGIN
  9103.             xsize := 320;
  9104.             ysize := 200;
  9105.         END;
  9106.         'b' : BEGIN
  9107.             xsize := 640;
  9108.             ysize := 480;
  9109.         END;
  9110.         'c' : BEGIN
  9111.             xsize := 800;
  9112.             ysize := 600;
  9113.         END;
  9114.         'd' : BEGIN
  9115.             xsize := 1024;
  9116.             ysize := 768;
  9117.         END;
  9118.         'e' : BEGIN
  9119.             xsize := 1280;
  9120.             ysize := 1024;
  9121.         END;
  9122.     END;
  9123.     CASE choice1 OF
  9124.         '1' : mode := FindVesaMode(xsize,ysize,8);
  9125.         '2' : mode := FindVesaMode(xsize,ysize,15);
  9126.         '3' : mode := FindVesaMode(xsize,ysize,16);
  9127.         '4' : mode := FindVesaMode(xsize,ysize,24);
  9128.     END;
  9129.     IF mode = 0 THEN BEGIN
  9130.         WriteLn('No such mode could be found !');
  9131.         WriteLn('Switching to to 320x200.');
  9132.         ReadKey;
  9133.         mode := V320x200x256;
  9134.     END;
  9135. END;
  9136.  
  9137. begin { program body }
  9138.   SelectMode;
  9139.   Initialize;
  9140.   ReportStatus;
  9141.  
  9142. {  AspectRatioPlay; }
  9143.   FillEllipsePlay;
  9144.   SectorPlay;
  9145.   WriteModePlay;
  9146.  
  9147.   ColorPlay;
  9148.   { PalettePlay only intended to work on these drivers: }
  9149.   if (GraphDriver = EGA) or
  9150.       (GraphDriver = EGA64) or
  9151.       (GraphDriver = VGA) then
  9152.      PalettePlay;
  9153.   PutPixelPlay;
  9154. {  PutImagePlay; }
  9155.   RandBarPlay;
  9156.   BarPlay;
  9157.   Bar3DPlay;
  9158.   ArcPlay;
  9159.   CirclePlay;
  9160.   PiePlay;
  9161.   LineToPlay;
  9162.   LineRelPlay;
  9163. {  LineStylePlay; }
  9164. {  UserLineStylePlay; }
  9165.   TextDump;
  9166.   TextPlay;
  9167.   CrtModePlay;
  9168.   FillStylePlay;
  9169.   FillPatternPlay;
  9170.   PolyPlay;
  9171.   SayGoodbye;
  9172. {  CloseGraph; }
  9173.   CloseVesa;
  9174. end.
  9175. ***************************************************
  9176.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  9177.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  9178. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  9179. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  9180. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  9181. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  9182.     Color := RandColor;
  9183.     SetColor(Color);
  9184.     SetFillStyle(Random(CloseDotFill)+1, Color);
  9185.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  9186.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  9187.   until KeyPressed;
  9188.   WaitToGo;
  9189. end; { RandBarPlay }
  9190.  
  9191. procedure ArcPlay;
  9192. { Draw random arcs on the screen }
  9193. var
  9194.   MaxRadius : word;
  9195.   EndAngle : word;
  9196.   ArcInfo : ArcCoordsType;
  9197. begin
  9198.   MainWindow('Arc / GetArcCoords demonstration');
  9199.   StatusLine('Esc aborts or press a key');
  9200.   MaxRadius := MaxY div 10;
  9201.   repeat
  9202.     SetColor(RandColor);
  9203.     EndAngle := Random(360);
  9204.     SetLineStyle(SolidLn, 0, NormWidth);
  9205.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  9206.     GetArcCoords(ArcInfo);
  9207.     with ArcInfo do
  9208.     begin
  9209.       Line(X, Y, XStart, YStart);
  9210.       Line(X, Y, Xend, Yend);
  9211.     end;
  9212.   until KeyPressed;
  9213.   WaitToGo;
  9214. end; { ArcPlay }
  9215.  
  9216. procedure PutPixelPlay;
  9217. { Demonstrate the PutPixel and GetPixel commands }
  9218. const
  9219.   Seed   = 1962; { A seed for the random number generator }
  9220.   NumPts = 2000; { The number of pixels plotted }
  9221.   Esc    = #27;
  9222. var
  9223.   I : word;
  9224.   X, Y, Color : word;
  9225.   XMax, YMax  : integer;
  9226.   ViewInfo    : ViewPortType;
  9227. begin
  9228.   MainWindow('PutPixel / GetPixel demonstration');
  9229.   StatusLine('Esc aborts or press a key...');
  9230.  
  9231.   GetViewSettings(ViewInfo);
  9232.   with ViewInfo do
  9233.   begin
  9234.     XMax := (x2-x1-1);
  9235.     YMax := (y2-y1-1);
  9236.   end;
  9237.  
  9238.   while not KeyPressed do
  9239.   begin
  9240.     { Plot random pixels }
  9241.     RandSeed := Seed;
  9242.     I := 0;
  9243.     while (not KeyPressed) and (I < NumPts) do
  9244.     begin
  9245.       Inc(I);
  9246.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  9247.     end;
  9248.  
  9249.     { Erase pixels }
  9250.     RandSeed := Seed;
  9251.     I := 0;
  9252.     while (not KeyPressed) and (I < NumPts) do
  9253.     begin
  9254.       Inc(I);
  9255.       X := Random(XMax)+1;
  9256.       Y := Random(YMax)+1;
  9257.       Color := GetPixel(X, Y);
  9258.         if Color = RandColor then
  9259.           PutPixel(X, Y, 0);
  9260.      end;
  9261.   end;
  9262.   WaitToGo;
  9263. end; { PutPixelPlay }
  9264.  
  9265. procedure PutImagePlay;
  9266. { Demonstrate the GetImage and PutImage commands }
  9267.  
  9268. const
  9269.   r  = 20;
  9270.   StartX = 100;
  9271.   StartY = 50;
  9272.  
  9273. var
  9274.   CurPort : ViewPortType;
  9275.  
  9276. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  9277. var
  9278.   Step : integer;
  9279. begin
  9280.   Step := Random(2*r);
  9281.   if Odd(Step) then
  9282.     Step := -Step;
  9283.   X := X + Step;
  9284.   Step := Random(r);
  9285.   if Odd(Step) then
  9286.     Step := -Step;
  9287.   Y := Y + Step;
  9288.  
  9289.   { Make saucer bounce off viewport walls }
  9290.   with CurPort do
  9291.   begin
  9292.     if (x1 + X + Width - 1 > x2) then
  9293.       X := x2-x1 - Width + 1
  9294.     else
  9295.       if (X < 0) then
  9296.         X := 0;
  9297.     if (y1 + Y + Height - 1 > y2) then
  9298.       Y := y2-y1 - Height + 1
  9299.     else
  9300.       if (Y < 0) then
  9301.         Y := 0;
  9302.   end;
  9303. end; { MoveSaucer }
  9304.  
  9305. var
  9306.   Pausetime : word;
  9307.   Saucer    : pointer;
  9308.   X, Y      : integer;
  9309.   ulx, uly  : word;
  9310.   lrx, lry  : word;
  9311.   Size      : word;
  9312.   I         : word;
  9313. begin
  9314.   ClearDevice;
  9315.   FullPort;
  9316.  
  9317.   { PaintScreen }
  9318.   ClearDevice;
  9319.   MainWindow('GetImage / PutImage Demonstration');
  9320.   StatusLine('Esc aborts or press a key...');
  9321.   GetViewSettings(CurPort);
  9322.  
  9323.   { DrawSaucer }
  9324.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  9325.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  9326.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  9327.   Circle(StartX+10, StartY-12, 2);
  9328.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  9329.   Circle(StartX-10, StartY-12, 2);
  9330.   SetFillStyle(SolidFill, MaxColor);
  9331.   FloodFill(StartX+1, StartY+4, GetColor);
  9332.  
  9333.   { ReadSaucerImage }
  9334.   ulx := StartX-(r+1);
  9335.   uly := StartY-14;
  9336.   lrx := StartX+(r+1);
  9337.   lry := StartY+(r div 3)+3;
  9338.  
  9339.   Size := ImageSize(ulx, uly, lrx, lry);
  9340.   GetMem(Saucer, Size);
  9341.   GetImage(ulx, uly, lrx, lry, Saucer^);
  9342. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  9343.  
  9344.   { Plot some "stars" }
  9345.   for I := 1 to 1000 do
  9346.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  9347.   X := MaxX div 2;
  9348.   Y := MaxY div 2;
  9349.   PauseTime := 70;
  9350.  
  9351.   { Move the saucer around }
  9352.   repeat
  9353. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  9354.      Delay(PauseTime);
  9355. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  9356.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  9357.   until KeyPressed;
  9358.   FreeMem(Saucer, size);
  9359.   WaitToGo;
  9360. end; { PutImagePlay }
  9361.  
  9362. procedure PolyPlay;
  9363. { Draw random polygons with random fill styles on the screen }
  9364. const
  9365.   MaxPts = 5;
  9366. type
  9367.   PolygonType = array[1..MaxPts] of PointType;
  9368. var
  9369.   Poly : PolygonType;
  9370.   I, Color : word;
  9371. begin
  9372.   MainWindow('FillPoly demonstration');
  9373.   StatusLine('Esc aborts or press a key...');
  9374.   repeat
  9375.     Color := RandColor;
  9376.     SetFillStyle(Random(11)+1, Color);
  9377.     SetColor(Color);
  9378.     for I := 1 to MaxPts do
  9379.       with Poly[I] do
  9380.       begin
  9381.         X := Random(MaxX);
  9382.         Y := Random(MaxY);
  9383.       end;
  9384.     FillPoly(MaxPts, Poly);
  9385.   until KeyPressed;
  9386.   WaitToGo;
  9387. end; { PolyPlay }
  9388.  
  9389. procedure FillStylePlay;
  9390. { Display all of the predefined fill styles available }
  9391. var
  9392.   Style    : word;
  9393.   Width    : word;
  9394.   Height   : word;
  9395.   X, Y     : word;
  9396.   I, J     : word;
  9397.   ViewInfo : ViewPortType;
  9398.  
  9399. procedure DrawBox(X, Y : word);
  9400. begin
  9401.   SetFillStyle(Style, MaxColor);
  9402.   with ViewInfo do
  9403.     Bar(X, Y, X+Width, Y+Height);
  9404.   Rectangle(X, Y, X+Width, Y+Height);
  9405.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  9406.   Inc(Style);
  9407. end; { DrawBox }
  9408.  
  9409. begin
  9410.   MainWindow('Pre-defined fill styles');
  9411.   GetViewSettings(ViewInfo);
  9412.   with ViewInfo do
  9413.   begin
  9414.     Width := 2 * ((x2+1) div 13);
  9415.     Height := 2 * ((y2-10) div 10);
  9416.   end;
  9417.   X := Width div 2;
  9418.   Y := Height div 2;
  9419.   Style := 0;
  9420.   for J := 1 to 3 do
  9421.   begin
  9422.     for I := 1 to 4 do
  9423.     begin
  9424.       DrawBox(X, Y);
  9425.       Inc(X, (Width div 2) * 3);
  9426.     end;
  9427.     X := Width div 2;
  9428.     Inc(Y, (Height div 2) * 3);
  9429.   end;
  9430.   SetTextJustify(LeftText, TopText);
  9431.   WaitToGo;
  9432. end; { FillStylePlay }
  9433.  
  9434. procedure FillPatternPlay;
  9435. { Display some user defined fill patterns }
  9436. const
  9437.   Patterns : array[0..11] of FillPatternType = (
  9438.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  9439.             OldColor which has a path of pixels of OldColor or NewColor
  9440.             with sides touching back to the seed point, (XSeed, YSeed).
  9441.             Therefore, only pixels of OldColor are modified and no other
  9442.             information is changed.
  9443.  
  9444.             SEE ALSO
  9445.  
  9446.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  9447.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  9448.             SETVIEW
  9449.  
  9450.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  9451.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  9452.             IF WHICHVGA = 0 THEN STOP
  9453.             DUMMY=RES640
  9454.             SETVIEW 100, 100, 539, 379
  9455.             FILLVIEW 10
  9456.             WHILE INKEY$ = ""
  9457.             WEND
  9458.             VIDEOMODESET VMODE
  9459.             END
  9460.  
  9461.  
  9462.  
  9463.  
  9464.  
  9465.  
  9466.  
  9467.  
  9468.  
  9469.  
  9470.  
  9471.  
  9472.  
  9473.  
  9474.  
  9475.  
  9476.                                                                          63
  9477.  
  9478.  
  9479.  
  9480.  
  9481.  
  9482.  
  9483.           FONTGETINFO
  9484.  
  9485.             PROTOTYPE
  9486.  
  9487.             SUB FONTGETINFO (Width%, Height%)
  9488.  
  9489.             INPUT
  9490.  
  9491.             no input parameters
  9492.     WEND
  9493.             MOUSEEXIT
  9494.             VIDEOMODESET VMODE
  9495.             END
  9496.  
  9497.  
  9498.  
  9499.  
  9500.  
  9501.  
  9502.  
  9503.  
  9504.  
  9505.  
  9506.  
  9507.  
  9508.  
  9509.  
  9510.  
  9511.  
  9512.  
  9513.  
  9514.  
  9515.  
  9516.  
  9517.  
  9518.  
  9519.  
  9520.  
  9521.  
  9522.  
  9523.  
  9524.  
  9525.  
  9526.  
  9527.  
  9528.  
  9529.  
  9530.  
  9531.  
  9532.  
  9533.  
  9534.  
  9535.  
  9536.                                                                          86
  9537.  
  9538.  
  9539.  
  9540.  
  9541.  
  9542.  
  9543.           MOUSECURSORDEFAULT
  9544.  
  9545.             PROTOTYPE
  9546.  
  9547.             SUB MOUSECURSORDEFAULT ()
  9548.  
  9549.             INPUT
  9550.  
  9551.             no input parameters
  9552.  
  9553.             OUTPUT
  9554.  
  9555.             no value returned
  9556.  
  9557.             USAGE
  9558.  
  9559.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  9560.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  9561. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  9562. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  9563. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  9564. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  9565. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  9566. $╤
  9567. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  9568. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  9569. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  9570. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  9571. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  9572. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  9573. ░£▒
  9574. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  9575. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  9576.       end;
  9577.     end;
  9578.   end;
  9579.   WaitToGo;
  9580. end; { UserLineStylePlay }
  9581.  
  9582.  
  9583. procedure SayGoodbye;
  9584. { Say goodbye and then exit the program }
  9585. var
  9586.   ViewInfo : ViewPortType;
  9587. begin
  9588.   MainWindow('');
  9589.   GetViewSettings(ViewInfo);
  9590.   SetTextStyle(TriplexFont, HorizDir, 4);
  9591.   SetTextJustify(CenterText, CenterText);
  9592.   with ViewInfo do
  9593.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  9594.   StatusLine('Press any key to quit...');
  9595.   repeat until KeyPressed;
  9596. end; { SayGoodbye }
  9597.  
  9598.  
  9599. PROCEDURE SelectMode;
  9600. VAR
  9601.     choice1,choice2     : CHAR;
  9602.    xsize,ysize            : WORD;
  9603. BEGIN
  9604.     (* Let's select a mode *)
  9605.     ClrScr;
  9606.     WriteLn('VESADEMO:');
  9607.     WriteLn('1. 256 colors');
  9608.     WriteLn('2. 32768 colors');
  9609.     WriteLn('3. 65536 colors');
  9610.     WriteLn('4. 16777216 colors');
  9611.     WriteLn('Q uit');
  9612.     WriteLn;
  9613.     Write('Your choice: ');
  9614.     REPEAT
  9615.         ReadLn(choice1);
  9616.       IF choice1 <> '1' THEN BEGIN
  9617.           WriteLn('Sorry !');
  9618.          WriteLn('This demo wasn''t written for more as 256 colors !');
  9619.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  9620.          WriteLn('Switching to 256 colors.');
  9621.          choice1 := '1';
  9622.       END;
  9623.     UNTIL choice1 IN ['1'..'4','q'];
  9624.     IF choice1 = 'q' THEN Halt;
  9625.  
  9626.     WriteLn;
  9627.     WriteLn;
  9628.     WriteLn('a. 320x200');
  9629.     WriteLn('b. 640x480');
  9630.     WriteLn('c. 800x600');
  9631.     WriteLn('d. 1024x768');
  9632.     WriteLn('e. 1280x1024');
  9633.     WriteLn('Q uit');
  9634.     WriteLn;
  9635.     Write('Your choice: ');
  9636.     REPEAT
  9637.         ReadLn(choice2);
  9638.     UNTIL choice2 IN ['a'..'e','q'];
  9639.     IF choice2 = 'q' THEN Halt;
  9640.  
  9641.     CASE choice2 OF
  9642.         'a' : BEGIN
  9643.             xsize := 320;
  9644.             ysize := 200;
  9645.         END;
  9646.         'b' : BEGIN
  9647.             xsize := 640;
  9648.             ysize := 480;
  9649.         END;
  9650.         'c' : BEGIN
  9651.             xsize := 800;
  9652.             ysize := 600;
  9653.         END;
  9654.         'd' : BEGIN
  9655.             xsize := 1024;
  9656.             ysize := 768;
  9657.         END;
  9658.         'e' : BEGIN
  9659.             xsize := 1280;
  9660.             ysize := 1024;
  9661.         END;
  9662.     END;
  9663.     CASE choice1 OF
  9664.         '1' : mode := FindVesaMode(xsize,ysize,8);
  9665.         '2' : mode := FindVesaMode(xsize,ysize,15);
  9666.         '3' : mode := FindVesaMode(xsize,ysize,16);
  9667.         '4' : mode := FindVesaMode(xsize,ysize,24);
  9668.     END;
  9669.     IF mode = 0 THEN BEGIN
  9670.         WriteLn('No such mode could be found !');
  9671.         WriteLn('Switching to to 320x200.');
  9672.         ReadKey;
  9673.         mode := V320x200x256;
  9674.     END;
  9675. END;
  9676.  
  9677. begin { program body }
  9678.   SelectMode;
  9679.   Initialize;
  9680.   ReportStatus;
  9681.  
  9682. {  AspectRatioPlay; }
  9683.   FillEllipsePlay;
  9684.   SectorPlay;
  9685.   WriteModePlay;
  9686.  
  9687.   ColorPlay;
  9688.   { PalettePlay only intended to work on these drivers: }
  9689.   if (GraphDriver = EGA) or
  9690.       (GraphDriver = EGA64) or
  9691.       (GraphDriver = VGA) then
  9692.